summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rwxr-xr-xgeneric/tclStrToD.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index eb57176..f306485 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
*/