<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/01/17b1dc91d01127781c5512160ebe2b0a"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-01-21T00:45:26"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )"
  prev="2003/01/9237a1295600c54fc49c20a8c1967a3f"
  next="2003/01/18adbbf91ec34b35351de3a8ecc5092f"
  prev-in-thread="2003/01/9237a1295600c54fc49c20a8c1967a3f"
  next-in-thread="2003/01/16f3332b61c5c9621ff8ca3d298d6272"
  prev-thread="2003/01/48b807e3da767c9c00767bf580dd3d3c"
  next-thread="2003/01/d89aa4bddc31c6f04c1b3b3cc50d0853"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] speed">
<msg 
  url="2003/01/564b13bda6a36ad2f6b58a1b2caae8b7"
  from="onlyclimb &lt;onlyclimb@1...&gt;"
  author="onlyclimb"
  date="2003-01-03T08:01:16"
  subject="[Caml-list] speed">
<msg 
  url="2003/01/6396a50720af493ebecfe69e70d65210"
  from="Clemens Hintze &lt;ml-ocaml@q...&gt;"
  author="Clemens Hintze"
  date="2003-01-03T11:40:04"
  subject="[Caml-list] Re: speed">
</msg>
<msg 
  url="2003/01/0c4ef0e894b828576d2829f4be49ccf7"
  from="Noel Welsh &lt;noelwelsh@y...&gt;"
  author="Noel Welsh"
  date="2003-01-03T11:47:56"
  subject="Re: [Caml-list] speed">
<msg 
  url="2003/01/5939290091b9aef1bbf2a819582f4646"
  from="Chet Murthy &lt;chet@w...&gt;"
  author="Chet Murthy"
  date="2003-01-03T12:46:02"
  subject="Re: [Caml-list] speed ">
</msg>
</msg>
<msg 
  url="2003/01/7f3e0f0d40f2c3480534632092c477ce"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-01-03T13:32:30"
  subject="Re: [Caml-list] speed">
<msg 
  url="2003/01/5feeb124e6be296bb910526dd7e54fa5"
  from="Chet Murthy &lt;chet@w...&gt;"
  author="Chet Murthy"
  date="2003-01-03T14:39:21"
  subject="Re: [Caml-list] speed ">
<msg 
  url="2003/01/1b59aa51ded51a144ef03855ffa0454f"
  from="Sven Luther &lt;luther@d...&gt;"
  author="Sven Luther"
  date="2003-01-03T14:53:44"
  subject="Re: [Caml-list] speed">
<msg 
  url="2003/01/0f323657ee94c6b6ec75dd120b80acc1"
  from="Erol Akarsu &lt;eakarsu@c...&gt;"
  author="Erol Akarsu"
  date="2003-01-03T15:30:13"
  subject="Re: [Caml-list] speed">
</msg>
</msg>
</msg>
<msg 
  url="2003/01/e671f63faa6e60a2d46808e7a5be3c21"
  from="Chet Murthy &lt;chet@w...&gt;"
  author="Chet Murthy"
  date="2003-01-03T14:40:28"
  subject="Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/84db8a13e8a42079be430c11235ea1b0"
  from="Shawn Wagner &lt;shawnw@s...&gt;"
  author="Shawn Wagner"
  date="2003-01-03T15:02:10"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/99cd8b7b3ca0d9d001871a37a4eba80f"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2003-01-03T15:56:32"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
<msg 
  url="2003/01/cfbfbda8c795246f69950e2e8ea00083"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-01-04T18:31:20"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/07ee33d3bd5bd0038b30b98207b154b7"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2003-01-18T22:50:01"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/17988bbd59483df8228db980cf6789fe"
  from="Shawn Wagner &lt;shawnw@s...&gt;"
  author="Shawn Wagner"
  date="2003-01-18T23:40:31"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/740ca05b3cb0c3e686a3998768c3564e"
  from="David Chase &lt;chase@w...&gt;"
  author="David Chase"
  date="2003-01-20T21:23:26"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/9237a1295600c54fc49c20a8c1967a3f"
  from="Nickolay Semyonov-Kolchin &lt;snob@s...&gt;"
  author="Nickolay Semyonov-Kolchin"
  date="2003-01-20T23:51:44"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/17b1dc91d01127781c5512160ebe2b0a"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-01-21T00:45:26"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
<msg 
  url="2003/01/16f3332b61c5c9621ff8ca3d298d6272"
  from="David Chase &lt;chase@w...&gt;"
  author="David Chase"
  date="2003-01-21T13:09:12"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/3e8e2b27f149125d2bc79f8f81f7238e"
  from="Daniel Andor &lt;da209@c...&gt;"
  author="Daniel Andor"
  date="2003-01-21T13:16:48"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
<msg 
  url="2003/01/f781fbd10809682f5020b87923bff572"
  from="Nickolay Semyonov-Kolchin &lt;snob@s...&gt;"
  author="Nickolay Semyonov-Kolchin"
  date="2003-01-22T07:22:18"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/01/2e377a963ff1b981e10398add3c66047"
  from="Siegfried Gonzi &lt;siegfried.gonzi@s...&gt;"
  author="Siegfried Gonzi"
  date="2003-01-19T09:43:32"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
<msg 
  url="2003/01/74a07e460d4553cfd41d33453e245700"
  from="Siegfried Gonzi &lt;siegfried.gonzi@s...&gt;"
  author="Siegfried Gonzi"
  date="2003-01-19T09:45:19"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
<msg 
  url="2003/01/826f0fbaad9a50b70a73bc0e8f5f0fde"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-01-21T09:56:51"
  subject="[Caml-list] Re: Coyote Gulch test in Caml">
<msg 
  url="2003/01/eea86615e9ca47c169bfb91694fa15f2"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-01-21T15:48:19"
  subject="Re: [Caml-list] Re: Coyote Gulch test in Caml">
</msg>
<msg 
  url="2003/01/32a48fbbe8cc060ff33f9088ef0b64c6"
  from="Daniel Andor &lt;da209@c...&gt;"
  author="Daniel Andor"
  date="2003-01-27T16:59:52"
  subject="Re: [Caml-list] Re: Coyote Gulch test in Caml">
<msg 
  url="2003/01/82d94403680b52187ef16b17c0a53ee4"
  from="Christian Lindig &lt;lindig@e...&gt;"
  author="Christian Lindig"
  date="2003-01-30T07:41:25"
  subject="Re: [Caml-list] Re: Coyote Gulch test in Caml">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/01/1c1f2f0f451d19c581c4bdf0276d6994"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-01-05T01:05:00"
  subject="Re: [Caml-list] speed">
<msg 
  url="2003/01/bf543fdffa5461b710cb9940d1260e33"
  from="Michael Vanier &lt;mvanier@c...&gt;"
  author="Michael Vanier"
  date="2003-01-05T20:17:34"
  subject="Re: [Caml-list] speed">
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
On Tue, 21 Jan 2003, Nickolay Semyonov-Kolchin wrote:

&gt; On Tuesday 21 January 2003 02:23, David Chase wrote:
&gt; 
&gt; Speed and accuracy are different things. Matlab class software need
&gt; accuracy, most computer games need speed. This is the reason of
&gt; "-ffast-math" key in gcc. Ocaml lacks such key, and always produce
&gt; ineffecient floating-point code.
&gt; 

&gt;From gcc's info:

`-ffast-math'
     This option allows GCC to violate some ANSI or IEEE rules and/or
     specifications in the interest of optimizing code for speed.  For
     example, it allows the compiler to assume arguments to the `sqrt'
     function are non-negative numbers and that no floating-point values
     are NaNs.

     This option should never be turned on by any `-O' option since it
     can result in incorrect output for programs which depend on an
     exact implementation of IEEE or ANSI rules/specifications for math
     functions.

Which raises a couple of questions.  The first question is wether 
-ffast-math mainly violates ANSI or IEEE rules.  If ANSI, we're OK- we 
just define the Ocaml rules so we don't have to violate them.

But then this brings up the issue of conformity vr.s performance.  For
example- the x86 has its 80-bit FP registers in 8087-legacy mode, but
64-bit registers if you're using SSE2.  And PowerPC and PA-RISC both have
extended precision fused multiply-adds (that keep higher precision, i.e.
don't round, between the multiply and the adds).  For that matter, could a 
"conforming" implementation of Ocaml use the 32-bit single precision SSE-1 
registers?

http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
http://www.cs.berkeley.edu/~wkahan/Curmudge.pdf

As a general rule, I perfer the higher precision when it doesn't hurt 
enormously.  Basically, keeping things at at least 64-bit IEEE FP is a 
good idea- except in special cases, the speed advantage of going down to 
single precision.

Oh, and if we're talking about performance, memory behavior is much more 
important than precision of floating point primitives (so long as FP is in 
hardware).  A complex FP operation may take tens of clock cycles- but a 
cache miss now takes hundreds.  The most important paper about numeric 
performance of Ocaml might be this one:
http://www.cs.princeton.edu/~mjrg/fpca95.ps.Z

Brian


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

</contents>

</message>

