From 7f7c29db5e61daaf10fcc3d319b47e4b9820f6f7 Mon Sep 17 00:00:00 2001 From: David Schultz Date: Tue, 8 May 2007 02:59:37 +0000 Subject: [PATCH] Fix a rounding error. Reported by: Bruno Haible --- lib/libc/gdtoa/_hdtoa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/gdtoa/_hdtoa.c b/lib/libc/gdtoa/_hdtoa.c index 11fc93ec976..5e8a1835cf7 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 */