summaryrefslogtreecommitdiffstats
path: root/generic/tclBinary.c
diff options
context:
space:
mode:
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;
+ }
}
/*