diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rwxr-xr-x | generic/tclStrToD.c | 11 |
2 files changed, 15 insertions, 1 deletions
@@ -11,6 +11,11 @@ reference in this function that valgrind caught. Also changed to return TCL_ERROR on a pure NaN. + * generic/tclStrToD.c (RefineResult): + Added a test for the initial approximation being HUGE_VAL; + this test avoids EDOM being returned from ldexp on some platforms + on input values exceeding the floating point range. + * tests/expr.test (expr-29.*, expr-30.*): Added further tests of overflow/underflow on input conversions. diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 2546333..f2c0632 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStrToD.c,v 1.1.2.8 2005/03/03 21:54:09 kennykb Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.1.2.9 2005/04/26 20:54:00 kennykb Exp $ * *---------------------------------------------------------------------- */ @@ -574,6 +574,15 @@ RefineResult( double approxResult, CONST char* p; /* + * The first approximation is always low. If we find that + * it's HUGE_VAL, we're done. + */ + + if ( approxResult == HUGE_VAL ) { + return approxResult; + } + + /* * Find a common denominator for the decimal and binary fractions. * The common denominator will be 2**M2 + 5**M5. */ |