caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] string_of_float less accurate than sprintf "%f" ?
@ 2002-04-30  8:21 Beck01, Wolfgang
  2002-05-02 12:44 ` John Max Skaller
  2002-05-04  8:53 ` Xavier Leroy
  0 siblings, 2 replies; 14+ messages in thread
From: Beck01, Wolfgang @ 2002-04-30  8:21 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [Caml-list] string_of_float less accurate than sprintf "%f" ?
@ 2002-05-03 19:25 David Chase
  0 siblings, 0 replies; 14+ messages in thread
From: David Chase @ 2002-05-03 19:25 UTC (permalink / raw)
  To: caml-list

Ignore the previous mail, Eudora, sent it for me when
I stumbled across ctrl-E, and I changed my mind about
sending it anyway.

David Chase

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2002-05-06 18:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-30  8:21 [Caml-list] string_of_float less accurate than sprintf "%f" ? Beck01, Wolfgang
2002-05-02 12:44 ` John Max Skaller
2002-05-02 12:54   ` Francois Thomasset
2002-05-05 17:33     ` John Max Skaller
2002-05-02 13:28   ` David Chase
2002-05-05 18:19     ` John Max Skaller
2002-05-02 13:46   ` jeanmarc.eber
2002-05-03 14:41   ` Oliver Bandel
     [not found]   ` <Pine.LNX.3.95.1020503162341.541E-100000@first.in-berlin.de >
2002-05-03 18:28     ` David Chase
2002-05-04  8:53 ` Xavier Leroy
2002-05-05  0:31   ` David McClain
2002-05-06 14:19   ` David Chase
2002-05-06 18:21     ` David McClain
2002-05-03 19:25 David Chase

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).