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: | 2002-05-03 (18:27) |
From: | David Chase <chase@w...> |
Subject: | Re: [Caml-list] string_of_float less accurate than sprintf "%f" ? |
At 04:41 PM 5/3/2002 +0200, Oliver Bandel wrote: >But a problem can occur too, when the type is not known >from within the program: When writing the string-representation >of a float to a file and read it back from the file, >then the non-float representation of the float yields >in parsing-/type-problems. >So that is a problem within the program and it's data >(I/O)... So this seems to be actually a problem. > >If (string_of_float 42.0) yields "42.0" (instead of "42"), >this maybe is not the right value, because it maybe is only >correct as "42.0000000000000"? >Well.... philosophical question? The "right" answer is to steal from Java, assuming that the floating point data types are relativ ------------------- 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