From: Corinna Vinschen Date: Wed, 19 Dec 2012 10:15:59 +0000 (+0000) Subject: * libc/stdlib/strtod.c (_strtod_r): Revert change from 2011-05-16. X-Git-Url: http://rtime.felk.cvut.cz/gitweb/fpga/lx-cpu1/newlib-tumbl.git/commitdiff_plain/bc66b5d666471dc946e34f9881d60a93a5387893 * libc/stdlib/strtod.c (_strtod_r): Revert change from 2011-05-16. --- diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 62c36c85..f8e2e4eb 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,7 @@ +2012-12-19 Corinna Vinschen + + * libc/stdlib/strtod.c (_strtod_r): Revert change from 2011-05-16. + 2012-12-18 Jeff Johnston * libc/include/math.h: Remove the log2f macro. diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c index 7e73b12a..fe6aac20 100644 --- a/newlib/libc/stdlib/strtod.c +++ b/newlib/libc/stdlib/strtod.c @@ -309,7 +309,8 @@ _DEFUN (_strtod_r, (ptr, s00, se), } nd0 = nd; if (strncmp (s, _localeconv_r (ptr)->decimal_point, - strlen (_localeconv_r (ptr)->decimal_point)) == 0) { + strlen (_localeconv_r (ptr)->decimal_point)) == 0) + { decpt = 1; c = *(s += strlen (_localeconv_r (ptr)->decimal_point)); if (!nd) { @@ -327,28 +328,25 @@ _DEFUN (_strtod_r, (ptr, s00, se), have_dig: nz++; if (c -= '0') { + nf += nz; for(i = 1; i < nz; i++) { - if (nd <= DBL_DIG + 1) { - if (nd + i < 10) + if (nd++ <= DBL_DIG + 1) { + if (nd < 10) y *= 10; else z *= 10; } } - if (nd <= DBL_DIG + 1) { - if (nd + i < 10) + if (nd++ <= DBL_DIG + 1) { + if (nd < 10) y = 10*y + c; else z = 10*z + c; } - if (nd <= DBL_DIG + 1) { - nf += nz; - nd += nz; - } nz = 0; + } } } - } dig_done: e = 0; if (c == 'e' || c == 'E') {