[MLton-commit] r4395
Matthew Fluet
MLton@mlton.org
Tue, 18 Apr 2006 17:53:21 -0700
Real{32,64} primitive semantics
----------------------------------------------------------------------
U mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/Makefile
A mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/config/default/default-real32.sml
U mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/primitive/prim-real.sml
U mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/IEEE-real.sml
U mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/real.fun
A mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/real0.sml
U mlton/branches/on-20050822-x86_64-branch/runtime/TODO
----------------------------------------------------------------------
Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/Makefile 2006-04-19 00:02:11 UTC (rev 4394)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/Makefile 2006-04-19 00:53:20 UTC (rev 4395)
@@ -26,7 +26,7 @@
CTYPES_MAPS = c-types.m32.map c-types.m64.map c-types.weird.map
DEFAULT_CHAR_MAPS = default-char8.map
DEFAULT_INT_MAPS = default-int32.map default-int64.map default-intinf.map
-DEFAULT_REAL_MAPS = default-real64.map
+DEFAULT_REAL_MAPS = default-real32.map default-real64.map
DEFAULT_WORD_MAPS = default-word32.map default-word64.map
.PHONY: type-check
Copied: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/config/default/default-real32.sml (from rev 4376, mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/config/default/default-real64.sml)
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/config/default/default-real64.sml 2006-03-04 19:37:37 UTC (rev 4376)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/config/default/default-real32.sml 2006-04-19 00:53:20 UTC (rev 4395)
@@ -0,0 +1,13 @@
+(* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
+ * Jagannathan, and Stephen Weeks.
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+structure Real = Real32
+type real = Real.real
+
+functor Real_ChooseRealN (A: CHOOSE_REALN_ARG) :
+ sig val f : Real.real A.t end =
+ ChooseRealN_Real32 (A)
Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/primitive/prim-real.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/primitive/prim-real.sml 2006-04-19 00:02:11 UTC (rev 4394)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/primitive/prim-real.sml 2006-04-19 00:53:20 UTC (rev 4395)
@@ -74,19 +74,23 @@
val strto: Primitive.NullString8.t -> real
val ~ : real -> real
+ (* Integer to float; depends on rounding mode. *)
val fromInt8Unsafe: Primitive.Int8.int -> real
val fromInt16Unsafe: Primitive.Int16.int -> real
val fromInt32Unsafe: Primitive.Int32.int -> real
val fromInt64Unsafe: Primitive.Int64.int -> real
+ (* Float to float; depends on rounding mode. *)
val fromReal32Unsafe: Primitive.Real32.real -> real
val fromReal64Unsafe: Primitive.Real64.real -> real
+ (* Float to integer, taking lowbits. *)
val toInt8Unsafe: real -> Primitive.Int8.int
val toInt16Unsafe: real -> Primitive.Int16.int
val toInt32Unsafe: real -> Primitive.Int32.int
val toInt64Unsafe: real -> Primitive.Int64.int
+ (* Float to float; depends on rounding mode. *)
val toReal32Unsafe: real -> Primitive.Real32.real
val toReal64Unsafe: real -> Primitive.Real64.real
end
Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/IEEE-real.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/IEEE-real.sml 2006-04-19 00:02:11 UTC (rev 4394)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/IEEE-real.sml 2006-04-19 00:53:20 UTC (rev 4395)
@@ -151,8 +151,7 @@
type exp = {digits: int list, negate: bool}
fun 'b afterE (state: 'a,
failure: unit -> 'b,
- success: exp * 'a -> 'b)
- : 'b =
+ success: exp * 'a -> 'b) : 'b =
case reader state of
NONE => failure ()
| SOME (c, state) =>
@@ -373,4 +372,3 @@
else num
end
end
-
Modified: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/real.fun
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/real.fun 2006-04-19 00:02:11 UTC (rev 4394)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/real.fun 2006-04-19 00:53:20 UTC (rev 4395)
@@ -12,7 +12,7 @@
local
open IEEEReal
in
- datatype z = datatype float_class
+ datatype float_class = datatype float_class
datatype rounding_mode = datatype rounding_mode
end
infix 4 == != ?=
Added: mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/real0.sml
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/real0.sml 2006-04-19 00:02:11 UTC (rev 4394)
+++ mlton/branches/on-20050822-x86_64-branch/basis-library.refactor/real/real0.sml 2006-04-19 00:53:20 UTC (rev 4395)
@@ -0,0 +1,16 @@
+(* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
+ * Jagannathan, and Stephen Weeks.
+ * Copyright (C) 1997-2000 NEC Research Institute.
+ *
+ * MLton is released under a BSD-style license.
+ * See the file MLton-LICENSE for details.
+ *)
+
+signature REAL0 =
+ sig
+ include PRIM_REAL
+
+ val zero: real
+ val one: real
+
+ end
\ No newline at end of file
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/TODO
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/TODO 2006-04-19 00:02:11 UTC (rev 4394)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/TODO 2006-04-19 00:53:20 UTC (rev 4395)
@@ -7,6 +7,14 @@
Fix PackWord{16,32,64}_{sub,upadate}{,Rev} to use byte offset; This
requires fixing the semantics of the primitives as well.
+Rename primitives to indicate that these are not bit-wise identities
+ Real_toWord
+ Real_toReal
+ Word_toReal
+and add primitives
+ Real_toWord, Word_toReal
+that correspond to bit-wise identities.
+
basis/Int/Word.c
basis/IntInf.c
basis/MLton/allocTooLarge.c