Index: generic/tclStrToD.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclStrToD.c,v
retrieving revision 1.52
diff -u -r1.52 tclStrToD.c
--- generic/tclStrToD.c	7 Dec 2010 16:27:39 -0000	1.52
+++ generic/tclStrToD.c	9 Dec 2010 08:10:48 -0000
@@ -314,7 +314,7 @@
 			    Tcl_WideUInt significand, int nSigDigs,
 			    int exponent);
 #ifdef IEEE_FLOATING_POINT
-static double		MakeNaN(int signum, Tcl_WideUInt tag);
+static double		MakeNaN(Tcl_WideUInt tag);
 #endif
 static double		RefineApproximation(double approx,
 			    mp_int *exactSignificand, int exponent);
@@ -1370,7 +1370,7 @@
 #ifdef IEEE_FLOATING_POINT
 	case sNAN:
 	case sNANFINISH:
-	    objPtr->internalRep.doubleValue = MakeNaN(signum,significandWide);
+	    objPtr->internalRep.doubleValue = MakeNaN(significandWide);
 	    objPtr->typePtr = &tclDoubleType;
 	    break;
 #endif
@@ -1747,7 +1747,6 @@
 #ifdef IEEE_FLOATING_POINT
 static double
 MakeNaN(
-    int signum,			/* Sign bit (1=negative, 0=nonnegative. */
     Tcl_WideUInt tags)		/* Tag bits to put in the NaN. */
 {
     union {
@@ -1757,11 +1756,7 @@
 
     theNaN.iv = tags;
     theNaN.iv &= (((Tcl_WideUInt) 1) << 51) - 1;
-    if (signum) {
-	theNaN.iv |= ((Tcl_WideUInt) (0x8000 | NAN_START)) << 48;
-    } else {
-	theNaN.iv |= ((Tcl_WideUInt) NAN_START) << 48;
-    }
+    theNaN.iv |= ((Tcl_WideUInt) NAN_START) << 48;
     if (n770_fp) {
 	theNaN.iv = Nokia770Twiddle(theNaN.iv);
     }
@@ -4913,7 +4908,6 @@
     }
     if (bitwhack.iv & ((Tcl_WideUInt) 1 << 63)) {
 	bitwhack.iv &= ~ ((Tcl_WideUInt) 1 << 63);
-	*buffer++ = '-';
     }
     *buffer++ = 'N';
     *buffer++ = 'a';
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	9 Dec 2010 08:10:48 -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*}
+} -match glob -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*}
+} -match glob -result {1 NaN*}
 
 test binary-41.1 {ScanNumber: word alignment} {
     unset -nocomplain arg1; unset arg2
@@ -2373,7 +2373,7 @@
 test binary-63.2 {NaN} ieeeFloatingPoint {
     binary scan [binary format q -NaN] w w
     format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
-} 0xfff0000000000000
+} 0x7ff0000000000000
 test binary-63.3 {NaN} ieeeFloatingPoint {
     binary scan [binary format q NaN(3123456789aBc)] w w
     format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
@@ -2382,6 +2382,13 @@
     binary scan [binary format q {NaN( 3123456789aBc)}] w w
     format 0x%016lx [expr {$w & 0xfff3ffffffffffff}]
 } 0x7ff3123456789abc
+test binary-63.5 {NaN roundtrip} ieeeFloatingPoint {
+    binary scan [binary format w 0xfff0000000000001] q d
+    binary scan [binary format q $d] w w
+    llength $d; #force shimmering
+    binary scan [binary format q $d] w r
+    list $d [format 0x%016lx $w] [format 0x%016lx $r]
+} {NaN(1) 0xfff0000000000001 0x7ff8000000000001}
 
 test binary-64.1 {NaN} -constraints ieeeFloatingPoint -body {
     binary scan [binary format w 0x7ff8000000000000] q d
Index: tests/util.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/util.test,v
retrieving revision 1.21
diff -u -r1.21 util.test
--- tests/util.test	28 Nov 2010 23:20:11 -0000	1.21
+++ tests/util.test	9 Dec 2010 08:10:48 -0000
@@ -1153,7 +1153,7 @@
      -body {
 	 testdoubledigits -NaN -1 shortest
      }
-    -result {NaN 9999 -}
+    -result {NaN 9999 +}
 }
 test util-12.5 {TclDoubleDigits - 0} {
      testdoubledigits 0.0 -1 shortest
@@ -1892,7 +1892,7 @@
     -body {
 	set ieeeValues(-NaN)
     }
-    -result -NaN
+    -result NaN
 }
 
 test util-14.2 {funky NaN} {*}{
@@ -1900,7 +1900,7 @@
     -body {
 	set ieeeValues(-NaN(3456789abcdef))
     }
-    -result -NaN(3456789abcdef)
+    -result NaN(3456789abcdef)
 }
 
 # cleanup
