diff options
author | dgp <dgp@users.sourceforge.net> | 2005-08-24 18:51:36 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2005-08-24 18:51:36 (GMT) |
commit | c22231d8fb2f411d0b1c44d9ef0e778a7e48f547 (patch) | |
tree | c93711f3e88703ef07f60c10cd1554d3fdb61ecf | |
parent | 4f2418c7c145dafac008782e58a5b896e0017c16 (diff) | |
download | tcl-c22231d8fb2f411d0b1c44d9ef0e778a7e48f547.zip tcl-c22231d8fb2f411d0b1c44d9ef0e778a7e48f547.tar.gz tcl-c22231d8fb2f411d0b1c44d9ef0e778a7e48f547.tar.bz2 |
[kennykb_numerics_branch]
* generic/tclExecute.c: Bug fix: TclBignumToDouble return -Inf when
appropriate. Removed declarations of removed routines.
-rw-r--r-- | ChangeLog | 3 | ||||
-rwxr-xr-x | generic/tclStrToD.c | 11 |
2 files changed, 9 insertions, 5 deletions
@@ -2,6 +2,9 @@ [kennykb_numerics_branch] + * generic/tclExecute.c: Bug fix: TclBignumToDouble return -Inf when + appropriate. Removed declarations of removed routines. + * generic/tclExecute.c: Revised the type promotion rules of the comparison operators so that they form proper equivalence classes over the set of numeric strings. diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 758401a..5c932f6 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -15,7 +15,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.31 2005/08/24 02:35:47 dgp Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.1.2.32 2005/08/24 18:51:36 dgp Exp $ * *---------------------------------------------------------------------- */ @@ -160,9 +160,6 @@ static double MakeNaN _ANSI_ARGS_(( int signum, Tcl_WideUInt tag )); static double RefineApproximation _ANSI_ARGS_((double approx, mp_int* exactSignificand, int exponent)); -static double RefineResult _ANSI_ARGS_((double approx, CONST char* start, - int nDigits, long exponent)); -static double ParseNaN _ANSI_ARGS_(( int signum, CONST char** end )); static double BignumToBiasedFrExp _ANSI_ARGS_(( mp_int* big, int* machexp )); static double Pow10TimesFrExp _ANSI_ARGS_(( int exponent, double fraction, @@ -2226,7 +2223,11 @@ TclBignumToDouble(mp_int *a) /* Integer to convert. */ bits = mp_count_bits(a); if (bits > DBL_MAX_EXP*log2FLT_RADIX) { errno = ERANGE; - return HUGE_VAL; + if (a->sign == MP_ZPOS) { + return HUGE_VAL; + } else { + return -HUGE_VAL; + } } shift = mantBits + 1 - bits; mp_init(&b); |