Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: [OT] Re: Java oddity

Author: Dieter Buerssner

Date: 16:41:53 09/10/02

Go up one level in this thread


On September 09, 2002 at 23:10:20, Robert Hyatt wrote:

>I can't believe _any_ compiler would use .001 since it can't be converted
>to IEEE FP exactly.  Dividing by 1000 is far more preferable as 1000 _can_
>be converted exactly.

gcc -ffast-math

Often (mostly?) this is nice. For example

  double a, b, c, d;

  /* I don't care about the last bit (only this can be different), but about
     speed */
  a /= d;
  b /= d;
  /* Or should I write:
  c = 1.0/d;
  a *= c;
  b *= c;
  A clever compiler may know, which is faster for this specific architecture.
  Many algorithms will work well either way, so one prefers the fastest method.
  A strict IEEE-conforming floating point environment, of course must not
  rearrange such expressions.
 */

Regards,
Dieter




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.