diff options
Diffstat (limited to 'generic/tclStrToD.c')
-rwxr-xr-x | generic/tclStrToD.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 2d622a7..feb0278 100755 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStrToD.c,v 1.2 2005/05/10 18:34:49 kennykb Exp $ + * RCS: @(#) $Id: tclStrToD.c,v 1.3 2005/05/10 20:17:42 kennykb Exp $ * *---------------------------------------------------------------------- */ @@ -60,6 +60,19 @@ typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__))); #define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw)) #endif +/* + * HP's PA_RISC architecture uses 7ff4000000000000 to represent a + * quiet NaN. Everyone else uses 7ff8000000000000. (Why, HP, why?) + */ + +#ifdef __hppa +# define NAN_START 0x7ff4 +# define NAN_MASK (((Tcl_WideUInt) 1) << 50) +#else +# define NAN_START 0x7ff8 +# define NAN_MASK (((Tcl_WideUInt) 1) << 51) +#endif + /* The powers of ten that can be represented exactly as IEEE754 doubles. */ #define MAXPOW 22 @@ -762,7 +775,7 @@ ParseNaN( int signum, /* Flag == 1 if minus sign has been } else if ( c >= 'a' && c <= 'f' ) { c = c - 'a' + 10; } else { - theNaN.iv = ( ((Tcl_WideUInt) 0x7ff8) << 48 ) + theNaN.iv = ( ((Tcl_WideUInt) NAN_START) << 48 ) | ( ((Tcl_WideUInt) signum) << 63 ); return theNaN.dv; } @@ -778,7 +791,7 @@ ParseNaN( int signum, /* Flag == 1 if minus sign has been if ( signum ) { theNaN.iv |= ((Tcl_WideUInt) 0xfff8) << 48; } else { - theNaN.iv |= ((Tcl_WideUInt) 0x7ff8) << 48; + theNaN.iv |= ((Tcl_WideUInt) NAN_START) << 48; } *endPtr = p; |