mirror of
https://github.com/reactos/reactos.git
synced 2024-10-01 23:14:53 +00:00
[CRT]
Fix exponential notation precision in scanf Patch by dmitry216 CORE-7010 #resolve svn path=/trunk/; revision=59365
This commit is contained in:
parent
aa185f871c
commit
9db307e83e
|
@ -279,7 +279,7 @@ _FUNCTION_ {
|
||||||
/* handle exponent */
|
/* handle exponent */
|
||||||
if (width!=0 && (nch == 'e' || nch == 'E')) {
|
if (width!=0 && (nch == 'e' || nch == 'E')) {
|
||||||
int exponent = 0, negexp = 0;
|
int exponent = 0, negexp = 0;
|
||||||
float expcnt;
|
double expcnt, shift;
|
||||||
nch = _GETC_(file);
|
nch = _GETC_(file);
|
||||||
if (width>0) width--;
|
if (width>0) width--;
|
||||||
/* possible sign on the exponent */
|
/* possible sign on the exponent */
|
||||||
|
@ -296,13 +296,15 @@ _FUNCTION_ {
|
||||||
if (width>0) width--;
|
if (width>0) width--;
|
||||||
}
|
}
|
||||||
/* update 'cur' with this exponent. */
|
/* update 'cur' with this exponent. */
|
||||||
expcnt = negexp ? 0.1f : 10.0f;
|
expcnt = 10;
|
||||||
|
shift = 1.0;
|
||||||
while (exponent!=0) {
|
while (exponent!=0) {
|
||||||
if (exponent&1)
|
if (exponent&1)
|
||||||
cur*=expcnt;
|
shift *= expcnt;
|
||||||
exponent/=2;
|
exponent/=2;
|
||||||
expcnt=expcnt*expcnt;
|
expcnt=expcnt*expcnt;
|
||||||
}
|
}
|
||||||
|
cur = (negexp ? cur / shift : cur * shift);
|
||||||
}
|
}
|
||||||
st = 1;
|
st = 1;
|
||||||
if (!suppress) {
|
if (!suppress) {
|
||||||
|
|
Loading…
Reference in a new issue