Author: tkreuzer
Date: Sat Jun 29 14:55:01 2013
New Revision: 59365
URL:
http://svn.reactos.org/svn/reactos?rev=59365&view=rev
Log:
[CRT]
Fix exponential notation precision in scanf
Patch by dmitry216
CORE-7010 #resolve
Modified:
trunk/reactos/lib/sdk/crt/string/scanf.h
Modified: trunk/reactos/lib/sdk/crt/string/scanf.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/scanf.h…
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/scanf.h [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/scanf.h [iso-8859-1] Sat Jun 29 14:55:01 2013
@@ -279,7 +279,7 @@
/* 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 @@
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) {