Attachment "3105247.patch" to
ticket [3105247fff]
added by
nijtmans
2010-11-10 18:10:44.
Index: generic/tclStrToD.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclStrToD.c,v
retrieving revision 1.46
diff -u -r1.46 tclStrToD.c
--- generic/tclStrToD.c 21 May 2010 12:43:29 -0000 1.46
+++ generic/tclStrToD.c 10 Nov 2010 11:05:47 -0000
@@ -2699,33 +2699,8 @@
double value, /* The Not-a-Number to format. */
char *buffer) /* String representation. */
{
-#ifndef IEEE_FLOATING_POINT
strcpy(buffer, "NaN");
return;
-#else
- union {
- double dv;
- Tcl_WideUInt iv;
- } bitwhack;
-
- bitwhack.dv = value;
- if (n770_fp) {
- bitwhack.iv = Nokia770Twiddle(bitwhack.iv);
- }
- if (bitwhack.iv & ((Tcl_WideUInt) 1 << 63)) {
- bitwhack.iv &= ~ ((Tcl_WideUInt) 1 << 63);
- *buffer++ = '-';
- }
- *buffer++ = 'N';
- *buffer++ = 'a';
- *buffer++ = 'N';
- bitwhack.iv &= (((Tcl_WideUInt) 1) << 51) - 1;
- if (bitwhack.iv != 0) {
- sprintf(buffer, "(%" TCL_LL_MODIFIER "x)", bitwhack.iv);
- } else {
- *buffer = '\0';
- }
-#endif /* IEEE_FLOATING_POINT */
}
/*
Index: tests/binary.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/binary.test,v
retrieving revision 1.43
diff -u -r1.43 binary.test
--- tests/binary.test 9 Nov 2010 14:20:19 -0000 1.43
+++ tests/binary.test 10 Nov 2010 11:05:47 -0000
@@ -1578,11 +1578,11 @@
test binary-40.3 {ScanNumber: NaN} -body {
unset -nocomplain arg1
list [binary scan \xff\xff\xff\xff f1 arg1] $arg1
-} -match glob -result {1 -NaN*}
+} -result {1 NaN}
test binary-40.4 {ScanNumber: NaN} -body {
unset -nocomplain arg1
list [binary scan \xff\xff\xff\xff\xff\xff\xff\xff d arg1] $arg1
-} -match glob -result {1 -NaN*}
+} -result {1 NaN}
test binary-41.1 {ScanNumber: word alignment} {
unset -nocomplain arg1; unset arg2
@@ -2389,8 +2389,9 @@
} -match glob -result NaN*
test binary-64.2 {NaN} -constraints ieeeFloatingPoint -body {
binary scan [binary format w 0x7ff0123456789aBc] q d
- set d
-} -match glob -result NaN(*123456789abc)
+ binary scan [binary format q $d] w d
+ expr {$d & 0x0fffffffffffff}
+} -result 20015998343868
test binary-65.1 {largest significand} ieeeFloatingPoint {
binary scan [binary format w 0x3fcfffffffffffff] q d