summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/prim.sml6
-rw-r--r--tests/float.ur6
-rw-r--r--tests/float.urs1
3 files changed, 8 insertions, 5 deletions
diff --git a/src/prim.sml b/src/prim.sml
index d4471143..96880487 100644
--- a/src/prim.sml
+++ b/src/prim.sml
@@ -55,11 +55,7 @@ fun int2s' n =
else
Int64.toString n
-fun float2s n =
- if Real64.compare (n, Real64.fromInt 0) = LESS then
- "-" ^ Real64.toString (Real64.~ n)
- else
- Real64.toString n
+val float2s = String.translate (fn #"~" => "-" | ch => str ch) o Real64.toString
fun toString t =
case t of
diff --git a/tests/float.ur b/tests/float.ur
new file mode 100644
index 00000000..aae6d521
--- /dev/null
+++ b/tests/float.ur
@@ -0,0 +1,6 @@
+fun main () =
+ let
+ val x = 0.001 * 50.0
+ in
+ return <xml><body>{[x]}</body></xml>
+ end
diff --git a/tests/float.urs b/tests/float.urs
new file mode 100644
index 00000000..6ac44e0b
--- /dev/null
+++ b/tests/float.urs
@@ -0,0 +1 @@
+val main : unit -> transaction page