diff options
author | nijtmans <nijtmans@noemail.net> | 2010-05-17 21:51:20 (GMT) |
---|---|---|
committer | nijtmans <nijtmans@noemail.net> | 2010-05-17 21:51:20 (GMT) |
commit | 88a2ada1ff38cf34b275595cc03cdb74aaaf0ab2 (patch) | |
tree | 1b71d7d950b2c2ccdbf42c3a54ff2b74b55ed27f /generic/tclStrToD.c | |
parent | 28e66101db60f72ad4c12fee76bec3db0a585a0f (diff) | |
download | tcl-88a2ada1ff38cf34b275595cc03cdb74aaaf0ab2.zip tcl-88a2ada1ff38cf34b275595cc03cdb74aaaf0ab2.tar.gz tcl-88a2ada1ff38cf34b275595cc03cdb74aaaf0ab2.tar.bz2 |
Fix [Bug 2996549]: Failure in expr.test on Win32
FossilOrigin-Name: 0958a5f61a28156f9e9759da2cbd3134a0e14634
Diffstat (limited to 'generic/tclStrToD.c')
-rwxr-xr-x | generic/tclStrToD.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 8094e87..1ee4c74 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -14,7 +14,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.44 2010/05/03 14:36:41 nijtmans Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.45 2010/05/17 21:51:21 nijtmans Exp $ * *---------------------------------------------------------------------- */ @@ -105,6 +105,7 @@ static int log2FLT_RADIX; /* Logarithm of the floating point radix. */ 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 = 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 @@ -1484,8 +1485,11 @@ MakeHighPrecisionDouble( goto returnValue; } retval = SafeLdExp(retval, machexp); - if (retval <= 0.0) { - retval = SafeLdExp(1.0, DBL_MIN_EXP * log2FLT_RADIX - mantBits); + if (tiny == 0.0) { + tiny = SafeLdExp(1.0, DBL_MIN_EXP * log2FLT_RADIX - mantBits); + } + if (retval < tiny) { + retval = tiny; } /* |