}
for (x=0; c-'0'<10U && x<INT_MAX/10; c = shgetc(f))
x = 10*x + c-'0';
- for (y=x; c-'0'<10U && x<LLONG_MAX/10; c = shgetc(f))
+ for (y=x; c-'0'<10U && x<LLONG_MAX/100; c = shgetc(f))
y = 10*y + c-'0';
for (; c-'0'<10U; c = shgetc(f));
shunget(f);
}
-static long double decfloat(FILE *f, int bits, int emin, int sign, int pok)
+static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int pok)
{
uint32_t x[KMAX];
static const uint32_t th[] = { LD_B1B_MAX };
long double y;
long double frac=0;
long double bias=0;
- int c;
j=0;
k=0;
- c = shgetc(f);
-
/* Don't let leading zeros consume buffer space */
for (; c=='0'; c = shgetc(f)) gotdig=1;
}
}
- 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;
}
e2 = 0;
}
+ } else {
+ shunget(f);
}
e2 += 4*rp - 32;
c = shgetc(f);
if ((c|32) == 'x')
return hexfloat(f, bits, emin, sign, pok);
+ shunget(f);
c = '0';
}
- shunget(f);
- return decfloat(f, bits, emin, sign, pok);
+ return decfloat(f, c, bits, emin, sign, pok);
}