From eea8077922683bcbf1bfa11eaf8f26e5c95c0b49 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Fri, 2 Apr 2010 19:23:57 +0000 Subject: * generic/tclStrToD.c: [Bug 2952904]: Defer creation of the smallest floating point number until it is actually used. (This change avoids a bogus syslog message regarding a 'floating point software assist fault' on SGI systems.) --- ChangeLog | 7 +++++++ generic/tclStrToD.c | 8 +++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb8a85f..7997e27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-04-02 Kevin B. Kenny + + * generic/tclStrToD.c: [Bug 2952904]: Defer creation of the smallest + floating point number until it is actually used. (This change avoids + a bogus syslog message regarding a 'floating point software assist + fault' on SGI systems.) + 2010-03-31 Donal K. Fellows * doc/registry.n: Added missing documentation of TIP#362 flags. diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 9577798..b9b9950 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.41 2010/03/05 14:34:04 dkf Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.42 2010/04/02 19:23:58 kennykb Exp $ * *---------------------------------------------------------------------- */ @@ -110,7 +110,6 @@ 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; /* 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 @@ -1490,8 +1489,8 @@ MakeHighPrecisionDouble( goto returnValue; } retval = SafeLdExp(retval, machexp); - if (retval < tiny) { - retval = tiny; + if (retval <= 0.0) { + retval = SafeLdExp(1.0, DBL_MIN_EXP * log2FLT_RADIX - mantBits); } /* @@ -2245,7 +2244,6 @@ TclInitDoubleConversion(void) * 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) -- cgit v0.12