# HG changeset patch # User Adam Chlipala # Date 1306842292 14400 # Node ID 4d04cb89649b98b1cf0d38361f4187e9aac1ff9b # Parent 8fce8593925963e4795d1565a8b4cfd96b61f51a Proper C pretty-printing of floats in scientific notation diff -r 8fce85939259 -r 4d04cb89649b src/prim.sml --- 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 diff -r 8fce85939259 -r 4d04cb89649b tests/float.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/float.ur Tue May 31 07:44:52 2011 -0400 @@ -0,0 +1,6 @@ +fun main () = + let + val x = 0.001 * 50.0 + in + return {[x]} + end diff -r 8fce85939259 -r 4d04cb89649b tests/float.urs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/float.urs Tue May 31 07:44:52 2011 -0400 @@ -0,0 +1,1 @@ +val main : unit -> transaction page