projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
67b25fe
)
floatscan: fix incorrect count of leading nonzero digits
author
Rich Felker
<dalias@aerifal.cx>
Mon, 16 Apr 2012 05:53:52 +0000
(
01:53
-0400)
committer
Rich Felker
<dalias@aerifal.cx>
Mon, 16 Apr 2012 05:53:52 +0000
(
01:53
-0400)
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.
src/internal/floatscan.c
patch
|
blob
|
history
diff --git
a/src/internal/floatscan.c
b/src/internal/floatscan.c
index 10123bfa4437ba64c0a15b664f4a48d9da2f6f64..377a008bd86600602c6d1fd877c47f2fa6b26626 100644
(file)
--- 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) {