about summary refs log tree commit diff
path: root/src/stdlib/atoi.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-04-07 02:05:20 -0400
committerRich Felker <dalias@aerifal.cx>2014-04-07 02:05:20 -0400
commit89740868c9f1c84b8ee528468d12df1fa72cd392 (patch)
treefb8252ea812c9700d650bf8bacc842efecec4f5d /src/stdlib/atoi.c
parent109048e031f39fbb370211fde44ababf6c04c8fb (diff)
downloadmusl-89740868c9f1c84b8ee528468d12df1fa72cd392.tar.gz
musl-89740868c9f1c84b8ee528468d12df1fa72cd392.tar.xz
musl-89740868c9f1c84b8ee528468d12df1fa72cd392.zip
fix failure of printf %g to strip trailing zeros in some cases
the code to strip trailing zeros was only looking in the last slot for
up to 9 zeros, assuming that the rounding code had already removed
fully-zero slots from the end. however, this ignored cases where the
rounding code did not run at all, which occur when the value being
printed is exactly representable in the requested precision.

the simplest solution is to move the code that strips trailing zero
slots to run unconditionally, immediately after rounding, rather than
as the last step of rounding.
Diffstat (limited to 'src/stdlib/atoi.c')
0 files changed, 0 insertions, 0 deletions