added Real structure (taken from SML/NJ basis lib);
authorwenzelm
Tue, 28 Jul 1998 17:02:41 +0200
changeset 5208 cea0adbc7276
parent 5207 dd4f51adfff3
child 5209 a69fe5a61b6c
added Real structure (taken from SML/NJ basis lib);
src/Pure/basis.ML
--- a/src/Pure/basis.ML	Tue Jul 28 16:59:15 1998 +0200
+++ b/src/Pure/basis.ML	Tue Jul 28 17:02:41 1998 +0200
@@ -42,6 +42,19 @@
   end;
 
 
+structure Real =
+  struct
+  fun toString (x: real) = makestring x;
+  fun max (x, y) = if x < y then y else x : real;
+  fun min (x, y) = if x < y then x else y : real;
+  val real = real;
+  val floor = floor;
+  fun ceil x = ~1 - floor (~ (x + 1.0));
+  fun round x = floor (x + 0.5);  (*does not do round-to-nearest*)
+  fun trunc x = if x < 0.0 then ceil x else floor x;
+  end;
+
+
 structure List =
   struct
   exception Empty