Re: trouble with -ffinite-math-only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Neal Becker <ndbecker2@xxxxxxxxx> writes:

> gcc-4.4.3-4.fc12.x86_64
>
> I have some code that gives wrong results if compiled with -ffinite-math-
> only.  I'm wondering what could cause this.  I don't really expect any 
> operations to produce NaN or Inf.  Is it true that this behavior could only 
> be explained if indeed some operation is producing NaN or Inf?

-ffinite-math by itself (i.e., without -ffast-math or
-funsafe-math-optimizations) should only enable optimizations which
assume that math operations never generate NaN or Inf.  This is
mainly optimizations around comparisons of various sorts.  If no NaN
can occur, the compiler has much more scope for optimizing floating
point comparisons.  While bugs are always possible, I don't know of
any case where code that never generates a NaN or an Inf will change
behaviour with -ffinite-math-only.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux