Attachment "2952904_2.patch" to
ticket [2952904fff]
added by
nijtmans
2010-05-19 18:49:55.
Index: generic/tclStrToD.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclStrToD.c,v
retrieving revision 1.33.2.3
diff -u -r1.33.2.3 tclStrToD.c
--- generic/tclStrToD.c 7 Dec 2009 17:14:28 -0000 1.33.2.3
+++ generic/tclStrToD.c 19 May 2010 11:48:15 -0000
@@ -109,7 +109,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 double tiny = 0.0; /* 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
@@ -1482,6 +1482,9 @@
goto returnValue;
}
retval = SafeLdExp(retval, machexp);
+ if (tiny == 0.0) {
+ tiny = SafeLdExp(1.0, DBL_MIN_EXP * log2FLT_RADIX - mantBits);
+ }
if (retval < tiny) {
retval = tiny;
}
@@ -2237,7 +2240,6 @@
* 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)