summaryrefslogtreecommitdiffstats
path: root/newlib/libc
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2008-10-06 19:47:06 +0000
committerJeff Johnston <jjohnstn@redhat.com>2008-10-06 19:47:06 +0000
commit0d2597f5a07cf946c921e66121f0b23aa4cc4d14 (patch)
treea857b17549d3e3d9759e14730a079820c9d5253b /newlib/libc
parent75fb38a5fb223e6b45617ce8bc3b275b0d806b85 (diff)
downloadcygnal-0d2597f5a07cf946c921e66121f0b23aa4cc4d14.tar.gz
cygnal-0d2597f5a07cf946c921e66121f0b23aa4cc4d14.tar.bz2
cygnal-0d2597f5a07cf946c921e66121f0b23aa4cc4d14.zip
2008-10-06 Eric Blake <ebb9@byu.net>
* libc/stdlib/ldtoa.c (etoasc): Fix rounding to even when fraction is 0.5 or 0.75.
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/stdlib/ldtoa.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/newlib/libc/stdlib/ldtoa.c b/newlib/libc/stdlib/ldtoa.c
index bb12f0cc7..5c2972593 100644
--- a/newlib/libc/stdlib/ldtoa.c
+++ b/newlib/libc/stdlib/ldtoa.c
@@ -3153,7 +3153,7 @@ if( digit > 4 )
emovo( y, t, ldp );
if( ecmp(t,ezero) != 0 )
goto roun; /* round to nearest */
- if( (*(s-1) & 1) == 0 )
+ if( ndigs < 0 || (*(s-1-(*(s-1)=='.')) & 1) == 0 )
goto doexp; /* round to even */
}
/* Round up and propagate carry-outs */