summaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-10 23:41:54 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-10 23:41:54 -0400
commit38b3f1fea8fe4f2c590c1a9438d219291a7bfcd2 (patch)
tree22a961338661c17966ae76e6f6dc9e150e283951 /src/internal
parent633a26c1e69b6a977d16086834f2b937e0378002 (diff)
downloadmusl-38b3f1fea8fe4f2c590c1a9438d219291a7bfcd2.tar.gz
fix float scanning of certain values ending in zeros
for example, "1000000000" was being read as "1" due to this loop exiting early. it's necessary to actually update z and zero the entries so that the subsequent rounding code does not get confused; before i did that, spurious inexact exceptions were being raised.
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/floatscan.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/internal/floatscan.c b/src/internal/floatscan.c
index ed735278..000706d7 100644
--- a/src/internal/floatscan.c
+++ b/src/internal/floatscan.c
@@ -225,8 +225,10 @@ static long double decfloat(FILE *f, int bits, int emin, int sign, int pok)
}
}
- for (y=i=0; i<LD_B1B_DIG && (a+i & MASK)!=z; i++)
+ for (y=i=0; i<LD_B1B_DIG; i++) {
+ if ((a+i & MASK)==z) x[z=(z+1 & MASK)] = 0;
y = 1000000000.0L * y + x[a+i & MASK];
+ }
y *= sign;