diff options
author | Rich Felker <dalias@aerifal.cx> | 2024-04-12 19:57:59 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2024-04-12 19:57:59 -0400 |
commit | 24ebbbdedcf626808a902d8797df239f94af9620 (patch) | |
tree | 564888e229857b2e34200a4c304d372279f1e0a6 /src/malloc/realloc.c | |
parent | e3b0ace505155b6b8e301d69924b0773fd82cb6e (diff) | |
download | musl-24ebbbdedcf626808a902d8797df239f94af9620.tar.gz |
printf: fix edge case where hex float precision was not honored
commit cfa0a54c082d41db6446638eed1d57f163434092 attempted to fix
rounding on archs where long double is not 80-bit (where LDBL_MANT_DIG
is not zero mod four), but failed to address the edge case where
rounding was skipped because LDBL_MANT_DIG/4 rounded down in the
comparison against the requested precision.
the rounding logic based on hex digit count is difficult to understand
and not well-motivated, so rather than try to fix it, replace it with
an explicit calculation in terms of number of bits to be kept, without
any truncating division operations. based on patch by Peter Ammon, but
with scalbn to apply the rounding exponent since the value will not
generally fit in any integer type. scalbn is used instead of scalbnl
to avoid pulling in the latter unnecessarily, since the value is an
exact power of two whose exponent range is bounded by LDBL_MANT_DIG, a
small integer.
Diffstat (limited to 'src/malloc/realloc.c')
0 files changed, 0 insertions, 0 deletions