From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id HAA10089; Mon, 6 May 2002 07:10:41 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA10105 for ; Mon, 6 May 2002 07:10:40 +0200 (MET DST) Received: from imo-m05.mx.aol.com (imo-m05.mx.aol.com [64.12.136.8]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g465AdH24980 for ; Mon, 6 May 2002 07:10:39 +0200 (MET DST) Received: from artboreb@netscape.net by imo-m05.mx.aol.com (mail_out_v32.5.) id 9.1b3.184700 (22683); Mon, 6 May 2002 01:10:29 -0400 (EDT) Received: from netscape.com (mow-m24.webmail.aol.com [64.12.137.1]) by air-in04.mx.aol.com (v84.14) with ESMTP id MAILININ44-0506011029; Mon, 06 May 2002 01:10:29 -0400 Date: Mon, 06 May 2002 01:10:29 -0400 From: artboreb@netscape.net (Arturo Borquez) To: skaller@ozemail.com.au (John Max Skaller) Cc: caml-list@inria.fr Subject: RE: Re: [Caml-list] string_of_float less accurate than sprintf "%f" ? Message-ID: <1D8D271E.572478E7.00958B05@netscape.net> X-Mailer: Atlas Mailer 2.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk John Max Skaller wrote: Hi all, >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. In fact "42" is only a string. Strictly it cannot be infered nothing else without a radix indicator and an explicit type of internal representation "42.0" should be interpreted as a decimal floating point value "42.00" another decimal floating point value with better accuracy "42o" would be interpreted as an octal value, integer, character or other? "42h" same, an hexadecimal value So the meaning of "42" only would be infered within the context on where "42" occurs. if "42" appear on the cash report of my credit card most probably it means a decimal currency value (or perhaps a code?) We do this all the time (infering), it is part of our culture, but sometimes the context imposes full strict information of "42" such as "42.0 +/- 1e-9" = "42.00000000" or "0x0042" or "+0x00000042" or "US$42.0" or "42 KSLOC" .......... or wathever My oppinion is that this stuff has nothing to do with Caml it is only related to code the correct printf in the correct place. Regards -- Arturo Borquez __________________________________________________________________ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ ------------------- 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