Browse thread
Strange behaviour of string_of_float
[
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: | Richard Jones <rich@a...> |
| Subject: | Re: [Caml-list] Strange behaviour of string_of_float |
On Sun, Jun 22, 2008 at 06:56:22PM +0200, Paolo Donadeo wrote: > string_of_float is not the inverse of float_of_string, at least in > this example. Yes, you wouldn't expect it to be, because the string is an approximate base 10 representation of the float (which is itself only an approximate base 2 representation of the transcendental number pi). You might want to read a presentation called "What every computer programmer should know about floating point arithmetic". There's a PDF version here: http://blogs.sun.com/darcy/resource/Wecpskafpa-ACCU.pdf Rich. -- Richard Jones Red Hat