diff options
| author | Kevin B Kenny <kennykb@acm.org> | 2005-05-10 18:33:37 (GMT) |
|---|---|---|
| committer | Kevin B Kenny <kennykb@acm.org> | 2005-05-10 18:33:37 (GMT) |
| commit | 925330a28892b1bcc0ddb2bf9546023bbfcb9114 (patch) | |
| tree | 2f108341f2c542f48532e6057d79bfa551a4245f /generic/tclBinary.c | |
| parent | 25f74cad490db33e7c876cdb823a7392e0ad02c8 (diff) | |
| download | tcl-925330a28892b1bcc0ddb2bf9546023bbfcb9114.zip tcl-925330a28892b1bcc0ddb2bf9546023bbfcb9114.tar.gz tcl-925330a28892b1bcc0ddb2bf9546023bbfcb9114.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.c | 15 |
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; + } } /* |
