Browse thread
[Caml-list] string_of_float less accurate than sprintf "%f" ?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Beck01, Wolfgang <BeckW@t...> |
| Subject: | [Caml-list] string_of_float less accurate than sprintf "%f" ? |
Hello, while doing some time measurements with Unix.gettimeofday() I discovered a problem with string_of_float: # string_of_float 123456789.123456789;; - : string = "123456789.123" OK, just it may by just an inaccuracy of the float type. However, sprintf returns a different result: # sprintf "%f" 123456789.123456789;; - : string = "123456789.1234567" I am using ocaml 3.02 under FreeBSD 4.5. However, the 'Changes' file did not mention string_of_float in more recent ocaml versions. My application needs to be fast (that's why I am using OCaml :-) and sprintf is of course slower than string_of_float. Did I miss a 'double' type in the manual? -- Wolfgang Beck T-Systems Nova GmbH ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners