summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index 0a191bb..527ed81 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -16,7 +16,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.444 2010/02/15 22:56:19 nijtmans Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.445 2010/02/21 08:56:19 nijtmans Exp $
*/
#include "tclInt.h"
@@ -7433,9 +7433,13 @@ ExprAbsFunc(
if (type == TCL_NUMBER_DOUBLE) {
double d = *((const double *) ptr);
+ static const double poszero = 0.0;
- if (d <= 0.0) {
- Tcl_SetObjResult(interp, Tcl_NewDoubleObj(-d));
+ /* We need to distinguish here between positive 0.0 and
+ * negative -0.0, see Bug ID #2954959.
+ */
+ if ((d <= -0.0) && memcmp(&d, &poszero, sizeof(double))) {
+ Tcl_SetObjResult(interp, Tcl_NewDoubleObj(-d));
} else {
Tcl_SetObjResult(interp, objv[1]);
}