diff options
author | David Schultz <das@FreeBSD.org> | 2008-09-03 07:23:57 +0000 |
---|---|---|
committer | David Schultz <das@FreeBSD.org> | 2008-09-03 07:23:57 +0000 |
commit | ae2cbf4c649fecd3302a3bea16672345582d2562 (patch) | |
tree | aa29ae5df5dd7a529e8fb86a22f1dd405bf30837 /contrib/gdtoa/strtoIg.c | |
parent | 6c1e69a28894e51d69a15e924043832156993450 (diff) | |
parent | e12da90037fc7c0b6420260fa6dddaacb2724204 (diff) | |
download | src-ae2cbf4c649fecd3302a3bea16672345582d2562.tar.gz src-ae2cbf4c649fecd3302a3bea16672345582d2562.zip |
Merge gdtoa 20080831. This fixes several bugs, including an infinite
loop pointed out by cognet@ that occurs when calling strtod() with a
string representing a number between DBL_MAX and 2*DBL_MAX, when the
rounding mode is anything other than the default.
Notes
Notes:
svn path=/head/; revision=182709
Diffstat (limited to 'contrib/gdtoa/strtoIg.c')
-rw-r--r-- | contrib/gdtoa/strtoIg.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/contrib/gdtoa/strtoIg.c b/contrib/gdtoa/strtoIg.c index ec46a3ebb755..90c88db3283d 100644 --- a/contrib/gdtoa/strtoIg.c +++ b/contrib/gdtoa/strtoIg.c @@ -61,12 +61,16 @@ strtoIg(CONST char *s00, char **se, FPI *fpi, Long *exp, Bigint **B, int *rvp) if (rv & STRTOG_Inexlo) { swap = 0; b1 = increment(b1); - if (fpi->sudden_underflow - && (rv & STRTOG_Retmask) == STRTOG_Zero) { - b1->x[0] = 0; - b1->x[nw1] = 1L << nb11; - rv1 += STRTOG_Normal - STRTOG_Zero; - rv1 &= ~STRTOG_Underflow; + if ((rv & STRTOG_Retmask) == STRTOG_Zero) { + if (fpi->sudden_underflow) { + b1->x[0] = 0; + b1->x[nw1] = 1L << nb11; + rv1 += STRTOG_Normal - STRTOG_Zero; + rv1 &= ~STRTOG_Underflow; + goto swapcheck; + } + rv1 &= STRTOG_Inexlo | STRTOG_Underflow | STRTOG_Zero; + rv1 |= STRTOG_Inexhi | STRTOG_Denormal; goto swapcheck; } if (b1->wds > nw |