Mercurial > urweb
changeset 1468:4d04cb89649b
Proper C pretty-printing of floats in scientific notation
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 31 May 2011 07:44:52 -0400 (2011-05-31) |
parents | 8fce85939259 |
children | a354b306f948 |
files | src/prim.sml tests/float.ur tests/float.urs |
diffstat | 3 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/prim.sml Mon May 30 09:31:50 2011 -0400 +++ b/src/prim.sml Tue May 31 07:44:52 2011 -0400 @@ -55,11 +55,7 @@ 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