Browse thread
[Caml-list] floating point input/conversion
-
Stefan Ratschan
- Olivier Andrieu
-
Christophe Raffalli
- Pierre Weis
[
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: | 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, http://pauillac.inria.fr/~weis ------------------- 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