summaryrefslogtreecommitdiffstats
path: root/generic/tclBinary.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2005-05-10 18:33:37 (GMT)
committerKevin B Kenny <kennykb@acm.org>2005-05-10 18:33:37 (GMT)
commit76e3b5eed61a674bce7f9c1e18380842dcff3fbf (patch)
tree2f108341f2c542f48532e6057d79bfa551a4245f /generic/tclBinary.c
parent5b510b75ec4a1d6fb55691bcf55dbf4b0b936624 (diff)
downloadtcl-76e3b5eed61a674bce7f9c1e18380842dcff3fbf.zip
tcl-76e3b5eed61a674bce7f9c1e18380842dcff3fbf.tar.gz
tcl-76e3b5eed61a674bce7f9c1e18380842dcff3fbf.tar.bz2
Merged kennykb-numerics-branch back to the head; TIPs 132 and 232
Diffstat (limited to 'generic/tclBinary.c')
-rw-r--r--generic/tclBinary.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 1b613d8..706d1f0 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBinary.c,v 1.21 2004/10/06 05:52:21 dgp Exp $
+ * RCS: @(#) $Id: tclBinary.c,v 1.22 2005/05/10 18:34:07 kennykb Exp $
*/
#include "tclInt.h"
@@ -1605,10 +1605,15 @@ FormatNumber(interp, type, src, cursorPtr)
case 'Q':
/*
* Double-precision floating point values.
+ * Tcl_GetDoubleFromObj returns TCL_ERROR for NaN, but
+ * we can check by comparing the object's type pointer.
*/
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
- return TCL_ERROR;
+ if ( src->typePtr != &tclDoubleType ) {
+ return TCL_ERROR;
+ }
+ dvalue = src->internalRep.doubleValue;
}
CopyNumber(&dvalue, *cursorPtr, sizeof(double), type);
*cursorPtr += sizeof(double);
@@ -1619,10 +1624,14 @@ FormatNumber(interp, type, src, cursorPtr)
case 'R':
/*
* Single-precision floating point values.
+ * Tcl_GetDoubleFromObj returns TCL_ERROR for NaN, but
+ * we can check by comparing the object's type pointer.
*/
if (Tcl_GetDoubleFromObj(interp, src, &dvalue) != TCL_OK) {
- return TCL_ERROR;
+ if ( src->typePtr != &tclDoubleType ) {
+ return TCL_ERROR;
+ }
}
/*