From: Rich Felker Date: Mon, 16 Apr 2012 05:53:52 +0000 (-0400) Subject: floatscan: fix incorrect count of leading nonzero digits X-Git-Tag: v0.8.8~26 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=2ac580fdfe1daf9924f221dc98878ae480306bfa;p=oweals%2Fmusl.git floatscan: fix incorrect count of leading nonzero digits this off-by-one error was causing values with just one digit past the decimal point to be treated by the integer case. in many cases it would yield the correct result, but if expressions are evaluated in excess precision, double rounding may occur. --- diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c index 10123bfa..377a008b 100644 --- a/src/internal/floatscan.c +++ b/src/internal/floatscan.c @@ -81,8 +81,8 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po if (lrp!=-1) break; lrp = dc; } else if (k < KMAX-2) { - if (c!='0') lnz = dc; dc++; + if (c!='0') lnz = dc; if (j) x[k] = x[k]*10 + c-'0'; else x[k] = c-'0'; if (++j==9) {