Browse thread
float rounding
[
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: | 2006-10-01 (12:41) |
From: | Florent Monnier <fmonnier@l...> |
Subject: | Re: [Caml-list] float rounding |
> I'm using Ocaml for an interval arithmetic application. I"m > curious about > what the Ocaml parser/compiler does to float constants. May I assume > that for any constant I enter, eg. 3.1415... (for N digits of pi), that > the compiler will give me a closest machine representable number? > i.e., if I bound a constant by the previous and next floating point > value to > that given me by the compiler, > will it always be the case that my original (mathematical) constant > lies in that interval? For the concrete exemple of PI, perhaps you could use a mathematical calculation to get its best value: # 4. *. atan 1. ;; - : float = 3.14159265358979312 (but the last number '2' is wrong) For other constants, maybe there are equivalent things?