2010-12-07 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/strtod.c(_strtod_r): Fix code to handle case whereby _DOUBLE_IS_32BITS is set and DBL_DIGS is 6 instead of 15.
This commit is contained in:
parent
f2588cb91d
commit
c317cb34b1
|
@ -1,3 +1,8 @@
|
||||||
|
2010-12-07 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
|
|
||||||
|
* libc/stdlib/strtod.c(_strtod_r): Fix code to handle case whereby
|
||||||
|
_DOUBLE_IS_32BITS is set and DBL_DIGS is 6 instead of 15.
|
||||||
|
|
||||||
2010-12-07 Ralf Corsépius <ralf.corsepius@rtems.org>
|
2010-12-07 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
* libc/include/strings.h: New (split-out from string.h).
|
* libc/include/strings.h: New (split-out from string.h).
|
||||||
|
|
|
@ -299,11 +299,14 @@ _DEFUN (_strtod_r, (ptr, s00, se),
|
||||||
}
|
}
|
||||||
s0 = s;
|
s0 = s;
|
||||||
y = z = 0;
|
y = z = 0;
|
||||||
for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)
|
for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) {
|
||||||
|
if (nd < DBL_DIG + 1) {
|
||||||
if (nd < 9)
|
if (nd < 9)
|
||||||
y = 10*y + c - '0';
|
y = 10*y + c - '0';
|
||||||
else if (nd < 16)
|
else
|
||||||
z = 10*z + c - '0';
|
z = 10*z + c - '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
nd0 = nd;
|
nd0 = nd;
|
||||||
if (strncmp (s, _localeconv_r (ptr)->decimal_point,
|
if (strncmp (s, _localeconv_r (ptr)->decimal_point,
|
||||||
strlen (_localeconv_r (ptr)->decimal_point)) == 0)
|
strlen (_localeconv_r (ptr)->decimal_point)) == 0)
|
||||||
|
@ -326,15 +329,20 @@ _DEFUN (_strtod_r, (ptr, s00, se),
|
||||||
nz++;
|
nz++;
|
||||||
if (c -= '0') {
|
if (c -= '0') {
|
||||||
nf += nz;
|
nf += nz;
|
||||||
for(i = 1; i < nz; i++)
|
for(i = 1; i < nz; i++) {
|
||||||
if (nd++ < 9)
|
if (nd++ <= DBL_DIG + 1) {
|
||||||
|
if (nd < 10)
|
||||||
y *= 10;
|
y *= 10;
|
||||||
else if (nd <= DBL_DIG + 1)
|
else
|
||||||
z *= 10;
|
z *= 10;
|
||||||
if (nd++ < 9)
|
}
|
||||||
|
}
|
||||||
|
if (nd++ <= DBL_DIG + 1) {
|
||||||
|
if (nd < 10)
|
||||||
y = 10*y + c;
|
y = 10*y + c;
|
||||||
else if (nd <= DBL_DIG + 1)
|
else
|
||||||
z = 10*z + c;
|
z = 10*z + c;
|
||||||
|
}
|
||||||
nz = 0;
|
nz = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue