Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: Pierre Weis <Pierre.Weis@i...>
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

If you have a patch to perform the conversion in linear time, we will
be more than happy to incorporate it into the library.

Thanks in advance,

Pierre Weis

INRIA, Projet Cristal,

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: