summaryrefslogtreecommitdiff
path: root/src
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
commit7a52cdb6ecf0e89c8a0f607855bcb81fbe0e0e68 (patch)
treeb3a79de42ade98bb9fec9492bdb97ce60ac48027 /src
parent7281024b45db2ddcc54cf6257fe5559b9b07aa93 (diff)
Proper C pretty-printing of floats in scientific notation
Diffstat (limited to 'src')
-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