This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: Floating Point Problem


>  Why would a program give me a output of all NaNs on my Pentium 4 and my
> Athlon64 , but not on my Pentium 3.
>  I used flags -O3 -ffast-math -mfpmath=sse on all machines. The Intel
> compiler 7.1 runs this program fine.
>
> How can I trace this problem down?

What version of the compiler are you using?

You can:
  1. isolate the optimisation switch that makes it happens; please
note that the documentation for -ffast-math says

     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 ISO rules/specifications for math
     functions.

  2. we have a patch in queue that will enable gfortran to raise a
Floating Point Exception (FPE) on invalid operations, division by
zero, overflow, underflow and loss of precision. Soon (or now, if
you're able to build a compiler with the patch at
http://gcc.gnu.org/ml/fortran/2005-09/msg00514.html) you'll be able to
compile your code with "gfortran -ffte-trap=invalid" and see the first
nan as it happens, and know (with GDB) where it happened and what
values had the different variables.

FX


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