[MLton-commit] r4078

Stephen Weeks MLton@mlton.org
Tue, 6 Sep 2005 17:47:08 -0700


Fixed bug in Real.signBit, which had assumed that the underlying C
signbit returned 0 or 1, when in fact any nonzero value is allowed to
indicate the signbit is set.


----------------------------------------------------------------------

U   mlton/trunk/basis-library/misc/primitive.sml
U   mlton/trunk/basis-library/real/real.fun
U   mlton/trunk/basis-library/real/real.sig
U   mlton/trunk/doc/changelog

----------------------------------------------------------------------

Modified: mlton/trunk/basis-library/misc/primitive.sml
===================================================================
--- mlton/trunk/basis-library/misc/primitive.sml	2005-09-06 23:31:48 UTC (rev 4077)
+++ mlton/trunk/basis-library/misc/primitive.sml	2005-09-07 00:47:05 UTC (rev 4078)
@@ -1350,7 +1350,7 @@
             val modf = _import "Real64_modf": real * real ref -> real;
             val nextAfter = _import "Real64_nextAfter": real * real -> real;
             val round = _prim "Real64_round": real -> real;
-            val signBit = _import "Real64_signBit": real -> bool;
+            val signBit = _import "Real64_signBit": real -> int;
             val strto = _import "Real64_strto": NullString.t -> real;
             val toInt = _prim "Real64_toWordS32": real -> int;
             val ~ = _prim "Real64_neg": real -> real;
@@ -1423,7 +1423,7 @@
             val minNormalPos = #1 _symbol "Real32_minNormalPos": real GetSet.t; ()
             val minPos = #1 _symbol "Real32_minPos": real GetSet.t; ()
             val modf = _import "Real32_modf": real * real ref -> real;
-            val signBit = _import "Real32_signBit": real -> bool;
+            val signBit = _import "Real32_signBit": real -> int;
             val strto = _import "Real32_strto": NullString.t -> real;
             val toInt = _prim "Real32_toWordS32": real -> int;
             val ~ = _prim "Real32_neg": real -> real;

Modified: mlton/trunk/basis-library/real/real.fun
===================================================================
--- mlton/trunk/basis-library/real/real.fun	2005-09-06 23:31:48 UTC (rev 4077)
+++ mlton/trunk/basis-library/real/real.fun	2005-09-07 00:47:05 UTC (rev 4078)
@@ -48,7 +48,7 @@
          val minPos = minPos
          val precision = precision
          val radix = radix
-         val signBit = signBit
+         val signBit = fn r => signBit r <> 0
          val toLarge = toLarge
       end
 

Modified: mlton/trunk/basis-library/real/real.sig
===================================================================
--- mlton/trunk/basis-library/real/real.sig	2005-09-06 23:31:48 UTC (rev 4077)
+++ mlton/trunk/basis-library/real/real.sig	2005-09-07 00:47:05 UTC (rev 4078)
@@ -41,7 +41,7 @@
       val nextAfterUp: real -> real
       val precision: int
       val radix: int
-      val signBit: real -> bool
+      val signBit: real -> int
       val strto: NullString.t -> real
       val toInt: real -> int
       val toLarge: real -> LargeReal.real        

Modified: mlton/trunk/doc/changelog
===================================================================
--- mlton/trunk/doc/changelog	2005-09-06 23:31:48 UTC (rev 4077)
+++ mlton/trunk/doc/changelog	2005-09-07 00:47:05 UTC (rev 4078)
@@ -1,5 +1,10 @@
 Here are the changes since version 20041109.
 
+* 2005-09-06
+  - Fixed bug in Real.signBit, which had assumed that the underlying
+    C signbit returned 0 or 1, when in fact any nonzero value is
+    allowed to indicate the signbit is set.
+
 * 2005-09-05
   - Added -mlb-path-map switch.