|
[Sponsors] |
July 25, 2002, 22:40 |
How to detect NaN's in Fortran
|
#1 |
Guest
Posts: n/a
|
Hi,friends
I would like to know how to detect NaN's in Fortran code. I want the code to stop at the first NaN when something gets weird and then step into. Thanks, Wen |
|
July 26, 2002, 03:44 |
Re: How to detect NaN's in Fortran
|
#2 |
Guest
Posts: n/a
|
Look up "exception handling" in the documentation for your compiler. The implementation will vary from compiler to compiler.
|
|
July 27, 2002, 09:05 |
Re: How to detect NaN's in Fortran
|
#3 |
Guest
Posts: n/a
|
Hi, if you are using F77, the following would be useful for debugging:
f77 -g -ftrap=common -O3 file.f -o file.e dbx file.e catch fpe run You will find out which value is zero ! Regards Li |
|
July 28, 2002, 23:38 |
Re: How to detect NaN's in Fortran
|
#4 |
Guest
Posts: n/a
|
If you use digital Visual Fortran, you can set the entry of floating point exception to 1 instead of 3 on project/setting/fortran/floating point.
Good luck! |
|
July 30, 2002, 22:07 |
Re: How to detect NaN's in Fortran
|
#5 |
Guest
Posts: n/a
|
Hi, there:
I have 2 methods: 1. To use Function IsNaN(*) * real it gives you a logical type 2. Do it my own way Check if (a + 1.0) .eq. a , only NaNs will give you a .true. answer Good luck! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fortran Compiler-CFX12.1 | Araz | CFX | 13 | March 27, 2017 05:37 |
Intrinsic Procedure 'ISNAN' in GNU FORTRAN 77 | hawk | Main CFD Forum | 1 | April 12, 2005 22:13 |
visual fortran | Monica | Main CFD Forum | 1 | August 28, 2004 20:45 |
Fortran77 or Fortran 90 | Swapnil | CFX | 2 | November 26, 2002 15:16 |
Why Favoring Fortran over C/C++? | Zi-Wei Chiou | Main CFD Forum | 35 | September 26, 2001 09:34 |