Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] floating point input/conversion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <christophe.raffalli@u...>
Subject: Re: [Caml-list] floating point input/conversion
Stefan Ratschan wrote:
> For the functions float_of_string and read_float the OCaml manual is
> very vague: "Convert the given string to a float".
> 
> In fact, this sentence is wrong. For example, the number 0.1 does not
> have a floating point representation, only approximations to it.
> 

Probably worst is the conversion from num to float (Num.float_of_num) 
which goes (or at least used to, I did not check 3.08.1) through
decimal representation as a string and is therefore not in constant time
as it could. This prevents a good implementation of what is called "lazy 
rational number" (you compute a float, but if it is not precise enough, 
then you compute an exact rational number)

-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature. The public key is
stored on www.keyserver.net
---------------------------------------------