summaryrefslogtreecommitdiffstats
path: root/lib/libc/gdtoa/_hdtoa.c
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2007-05-08 02:59:37 +0000
committerdas <das@FreeBSD.org>2007-05-08 02:59:37 +0000
commitcdcf6057603b6a1311a5714de33c0ae231152741 (patch)
treebec6e176ba6c464bae2bc3992cf76e56f4b82eef /lib/libc/gdtoa/_hdtoa.c
parent532412f6c49a9077f90f5cd40b66c87a16efe085 (diff)
downloadFreeBSD-src-cdcf6057603b6a1311a5714de33c0ae231152741.zip
FreeBSD-src-cdcf6057603b6a1311a5714de33c0ae231152741.tar.gz
Fix a rounding error.
Reported by: Bruno Haible
Diffstat (limited to 'lib/libc/gdtoa/_hdtoa.c')
-rw-r--r--lib/libc/gdtoa/_hdtoa.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/gdtoa/_hdtoa.c b/lib/libc/gdtoa/_hdtoa.c
index 11fc93e..5e8a1835 100644
--- a/lib/libc/gdtoa/_hdtoa.c
+++ b/lib/libc/gdtoa/_hdtoa.c
@@ -78,7 +78,7 @@ dorounding(char *s0, int ndigits, int sign, int *decpt)
break;
case 1: /* to nearest, halfway rounds to even */
if ((s0[ndigits] > 8) ||
- (s0[ndigits] == 8 && s0[ndigits - 1] & 1))
+ (s0[ndigits] == 8 && s0[ndigits + 1] & 1))
adjust = roundup(s0, ndigits);
break;
case 2: /* toward +inf */
OpenPOWER on IntegriCloud