Attachment "2996549.patch" to
ticket [2996549fff]
added by
nijtmans
2010-05-04 20:21:58.
Index: generic/tclStrToD.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclStrToD.c,v
retrieving revision 1.44
diff -u -r1.44 tclStrToD.c
--- generic/tclStrToD.c 3 May 2010 14:36:41 -0000 1.44
+++ generic/tclStrToD.c 4 May 2010 13:20:36 -0000
@@ -105,6 +105,7 @@
static int mantBits; /* Number of bits in a double's significand */
static mp_int pow5[9]; /* Table of powers of 5**(2**n), up to
* 5**256 */
+static double tiny; /* The smallest representable double */
static int maxDigits; /* The maximum number of digits to the left of
* the decimal point of a double. */
static int minDigits; /* The maximum number of digits to the right
@@ -1484,8 +1485,8 @@
goto returnValue;
}
retval = SafeLdExp(retval, machexp);
- if (retval <= 0.0) {
- retval = SafeLdExp(1.0, DBL_MIN_EXP * log2FLT_RADIX - mantBits);
+ if (retval < tiny) {
+ retval = tiny;
}
/*
@@ -2239,6 +2240,7 @@
* the significand of a double.
*/
+ tiny = SafeLdExp(1.0, DBL_MIN_EXP * log2FLT_RADIX - mantBits);
maxDigits = (int) ((DBL_MAX_EXP * log((double) FLT_RADIX)
+ 0.5 * log(10.)) / log(10.));
minDigits = (int) floor((DBL_MIN_EXP - DBL_MANT_DIG)