summaryrefslogtreecommitdiff
path: root/src/prim.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-05-31 07:44:52 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-05-31 07:44:52 -0400
commit6d144445b780d0acdb46b36702b28be17eca1049 (patch)
treeb3a79de42ade98bb9fec9492bdb97ce60ac48027 /src/prim.sml
parentce09df0fd2af2465c1df0fbeacf0cb6a07cd2add (diff)
Proper C pretty-printing of floats in scientific notation
Diffstat (limited to 'src/prim.sml')
-rw-r--r--src/prim.sml6
1 files changed, 1 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