This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC and Floating-Point


On 2005-05-24 09:04:11 +0200, Uros Bizjak wrote:
>   I would like to point out that for applications that crunch data
> from real world (no infinites or nans, where precision is not
> critical) such as various simulations, -ffast-math is something that
> can speed up application a lot.

But note that even when precision is not critical, you may get
consistency problems or annoying unintuitive side effects. For
instance, see

  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15134

where

float x = 30.0;
int main()
{
  if ( 90.0/x != 3.0)
    abort();
  return 0;
}

fails with -ffast-math (on x86). I would not recommend it, unless
the user knows all the consequences.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]