mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-10-02 04:02:30 +03:00
H5Z__format_double_canonical() previously found the shortest round-tripping %.*g precision by brute-force search, verified with an strtod() readback. On HDFGroup/hdf5#6153 we agreed a well-tested library was the safer choice for a conversion that lands in the on-disk format, and settled on Ryu. Vendors the double-to-shortest-decimal subset of Ryu (src/ryu), following the same pattern as the existing tomlc17 vendoring: pristine upstream sources pinned to a commit, per-file SHA-256s, an HDF5-authored h5_ryu_prefix.h renaming its globals via force-include, and matching CMake treatment for symbol visibility and warnings. Ryu emits unconditional scientific notation with no padding (3.0 -> "3E0"), so H5Z__format_double_canonical() takes its digit string and decimal exponent apart and lays them out %g-style -- fixed-point in the human-scale range, scientific outside it -- which keeps the canonical form unchanged (rate = 3.5, not rate = 3.5E0) and needs no strtod() round-trip check: the re-layout only moves the decimal point. Ryu also writes ASCII digits directly rather than through locale-sensitive snprintf(), so the localeconv() decimal-separator fixup the old implementation needed is gone. Updated the get_config plugin contract, the h5repack/h5tools rationale comments, and tooling (clang-format, codespell, format_source) that exempted src/tomlc17 to exempt src/ryu the same way. Verified with a 2M-sample bit-pattern sweep plus all 2098 powers of two round-tripping bit-exact through the new formatter, and the full tfilter2 canonicalization suite passing unchanged.
Scripts in bin and their purpose
| Program | Purpose |
|---|---|
checkapi |
Checks if public API calls are used in internal functions |
chkcopyright |
Checks if files have appropriate copyright statements |
debug-ohdr |
Examines debug output from H5O_open/close to look for open objects |
format_source |
Runs clang-format over the source files, applying our rules |
genparser |
Creates the flex/bison-based parser files in the high-level library |
h5cc.in |
Input file from which h5cc is created |
h5redeploy.in |
Input file from which h5redeploy is created |
make_err |
Generates the H5E header files |
make_vers |
Generates H5version.h |
make_overflow |
Generates H5overflow.h |
output_filter |
Used in the tools test code to strip extraneous output before we diff files |
runbkprog |
Used by CMake to run test programs in the background |
trace |
Updates H5ARG_TRACE macros in H5ES_insert() calls |
warnhist |
Generates compiler warning statistics for gcc/clang when fed output of make |
TODO
- chkcopyright is currently semi-broken as it doesn't handle the full variety of copyright headers we need. We're leaving it in place, though, in the hopes that someone will update it in the future.
- Extending warnhist to better understand the output of additional compilers/languages would be nice.