[Bug math/30220] String to double returns incorrectly rounded value for hexadecimal subnormal
cvs-commit at gcc dot gnu.org
sourceware-bugzilla@sourceware.org
Fri Sep 27 16:00:36 GMT 2024
https://sourceware.org/bugzilla/show_bug.cgi?id=30220
--- Comment #5 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The release/2.39/master branch has been updated by Arjun Shankar
<arjun@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a7be595c67d12f1a442e3f6894d67e20c7724bed
commit a7be595c67d12f1a442e3f6894d67e20c7724bed
Author: Joseph Myers <josmyers@redhat.com>
Date: Tue Aug 27 12:41:02 2024 +0000
Fix strtod subnormal rounding (bug 30220)
As reported in bug 30220, the implementation of strtod-family
functions has a bug in the following case: the input string would,
with infinite exponent range, take one more bit to represent than is
available in the normal precision of the return type; the value
represented is in the subnormal range; and there are no nonzero bits
in the value, below those that can be represented in subnormal
precision, other than the least significant bit and possibly the
0.5ulp bit. In this case, round_and_return ends up discarding the
least significant bit.
Fix by saving that bit to merge into more_bits (it can't be merged in
at the time it's computed, because more_bits mustn't include this bit
in the case of after-rounding tininess detection checking if the
result is still subnormal when rounded to normal precision, so merging
this bit into more_bits needs to take place after that check).
Tested for x86_64.
(cherry picked from commit 457622c2fa8f9f7435822d5287a437bc8be8090d)
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list