diff options
author | Szabolcs Nagy <nsz@port70.net> | 2016-09-04 04:46:00 +0200 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2016-10-20 13:29:09 -0400 |
commit | d184a09e0529f33d8ddddb8825039133483a2c41 (patch) | |
tree | efccccc90b44504aa5ed2b04cd0cf15e1b291a80 /src/internal/libm.h | |
parent | f33b17585058381491e6fda08f491b8e48c7980c (diff) | |
download | musl-d184a09e0529f33d8ddddb8825039133483a2c41.tar.gz musl-d184a09e0529f33d8ddddb8825039133483a2c41.tar.bz2 musl-d184a09e0529f33d8ddddb8825039133483a2c41.tar.xz musl-d184a09e0529f33d8ddddb8825039133483a2c41.zip |
fix strtod and strtof rounding with many trailing zeros
in certain cases excessive trailing zeros could cause incorrect
rounding from long double to double or float in decfloat.
e.g. in strtof("9444733528689243848704.000000", 0) the argument
is 0x1.000001p+73, exactly halfway between two representible floats,
this incorrectly got rounded to 0x1.000002p+73 instead of 0x1p+73,
but with less trailing 0 the rounding was fine.
the fix makes sure that the z index always points one past the last
non-zero digit in the base 10^9 representation, this way trailing
zeros don't affect the rounding logic.
Diffstat (limited to 'src/internal/libm.h')
0 files changed, 0 insertions, 0 deletions