diff options
author | dgp <dgp@users.sourceforge.net> | 2008-03-10 16:18:50 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2008-03-10 16:18:50 (GMT) |
commit | 59ee2f1e347fb19a9228787a2fc637dbff1d875c (patch) | |
tree | d25c01ba6d2e399dc1205f75bdac979894afd528 /generic | |
parent | 549c3cdc807fe8a0a783fbb3d82d622afca1677e (diff) | |
download | tcl-59ee2f1e347fb19a9228787a2fc637dbff1d875c.zip tcl-59ee2f1e347fb19a9228787a2fc637dbff1d875c.tar.gz tcl-59ee2f1e347fb19a9228787a2fc637dbff1d875c.tar.bz2 |
* generic/tclBasic.c (ExprAbsFunc): Revised so that the abs()
* tests/expr.test: function and the [::tcl::mathfunc::abs]
command do not return the value of -0, or equivalent values with
more alarming string reps like -1e-350. [Bug 1893815].
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclBasic.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 48e7059..b7f3423 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.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: tclBasic.c,v 1.293 2008/02/29 19:59:59 dgp Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.294 2008/03/10 16:18:54 dgp Exp $ */ #include "tclInt.h" @@ -5963,7 +5963,7 @@ ExprAbsFunc( if (type == TCL_NUMBER_LONG) { long l = *((const long *) ptr); - if (l < (long)0) { + if (l <= (long)0) { if (l == LONG_MIN) { TclBNInitBignumFromLong(&big, l); goto tooLarge; @@ -5977,7 +5977,7 @@ ExprAbsFunc( if (type == TCL_NUMBER_DOUBLE) { double d = *((const double *) ptr); - if (d < 0.0) { + if (d <= 0.0) { Tcl_SetObjResult(interp, Tcl_NewDoubleObj(-d)); } else { Tcl_SetObjResult(interp, objv[1]); |