English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
[Caml-list] string_of_float less accurate than sprintf "%f" ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] string_of_float less accurate than sprintf "%f" ?
Francois Thomasset wrote:

>>Beck01, Wolfgang wrote:
>>
>>There's another problem too:
>>
>># string_of_float 42.0;;
>>- : string = "42"
>>
>>The result isn't an ocaml float literal.
>>
>Is it not?
># float_of_string (string_of_float 42.0);;
>- : float = 42
>So if you know that there is a float in the string, it is a float isn't it?
>
It isn't a floating point literal, in ocaml, C, or any other language.
Floating point literals always have either a decimal indicator
or an exponent. It should return "42.0", in my opinion:
"42" is an integer.

-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850




-------------------
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