Files
hdf5/.github
M. Scot Breitenfeld 305f1df3bf Use vendored Ryu for shortest-round-trip filter-param formatting
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.
2026-09-19 18:11:31 -05:00
..
2025-07-09 14:51:45 -05:00