Fix exponential notation precision in scanf 
Patch by dmitry216
CORE-7010 #resolve

svn path=/trunk/; revision=59365
This commit is contained in:
Timo Kreuzer 2013-06-29 14:55:01 +00:00
parent aa185f871c
commit 9db307e83e

View file

@ -279,7 +279,7 @@ _FUNCTION_ {
/* handle exponent */
if (width!=0 && (nch == 'e' || nch == 'E')) {
int exponent = 0, negexp = 0;
float expcnt;
double expcnt, shift;
nch = _GETC_(file);
if (width>0) width--;
/* possible sign on the exponent */
@ -296,13 +296,15 @@ _FUNCTION_ {
if (width>0) width--;
}
/* update 'cur' with this exponent. */
expcnt = negexp ? 0.1f : 10.0f;
expcnt = 10;
shift = 1.0;
while (exponent!=0) {
if (exponent&1)
cur*=expcnt;
shift *= expcnt;
exponent/=2;
expcnt=expcnt*expcnt;
}
cur = (negexp ? cur / shift : cur * shift);
}
st = 1;
if (!suppress) {