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 RAA17040; Wed, 1 May 2002 17:35:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA17035 for caml-list@pauillac.inria.fr; Wed, 1 May 2002 17:35:46 +0200 (MET DST) 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 KAA18015 for ; Tue, 30 Apr 2002 10:21:56 +0200 (MET DST) Received: from mail1.telekom.de (mail1.telekom.de [62.225.183.235]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g3U8LtH13082 for ; Tue, 30 Apr 2002 10:21:55 +0200 (MET DST) Received: from g9jbr.mgb01.telekom.de by G8SBV.dmz.telekom.de with ESMTP for caml-list@inria.fr; Tue, 30 Apr 2002 10:20:33 +0200 Received: by G9JBR.mgb01.telekom.de with Internet Mail Service (5.5.2653.19) id ; Tue, 30 Apr 2002 10:21:44 +0200 Message-Id: From: "Beck01, Wolfgang" To: caml-list@inria.fr Subject: [Caml-list] string_of_float less accurate than sprintf "%f" ? Date: Tue, 30 Apr 2002 10:21:43 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="ISO-8859-1" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, while doing some time measurements with Unix.gettimeofday() I discovered a problem with string_of_float: # string_of_float 123456789.123456789;; - : string = "123456789.123" OK, just it may by just an inaccuracy of the float type. However, sprintf returns a different result: # sprintf "%f" 123456789.123456789;; - : string = "123456789.1234567" I am using ocaml 3.02 under FreeBSD 4.5. However, the 'Changes' file did not mention string_of_float in more recent ocaml versions. My application needs to be fast (that's why I am using OCaml :-) and sprintf is of course slower than string_of_float. Did I miss a 'double' type in the manual? -- Wolfgang Beck T-Systems Nova GmbH ------------------- 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