about summary refs log tree commit diff
path: root/stdio-common/perror.c
diff options
context:
space:
mode:
authorJoseph Myers <josmyers@redhat.com>2024-08-27 12:41:02 +0000
committerArjun Shankar <arjun@redhat.com>2024-09-27 17:24:21 +0200
commitd0c1792ad269566f877208ffda91c21dcd1a72e6 (patch)
treeefe3a00370eb2860f0a6532af9ee46a89bd985c0 /stdio-common/perror.c
parente06153665fa931e4c7d2a3ecc14e5197e96143a7 (diff)
downloadglibc-d0c1792ad269566f877208ffda91c21dcd1a72e6.tar.gz
glibc-d0c1792ad269566f877208ffda91c21dcd1a72e6.tar.xz
glibc-d0c1792ad269566f877208ffda91c21dcd1a72e6.zip
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)
Diffstat (limited to 'stdio-common/perror.c')
0 files changed, 0 insertions, 0 deletions