|
[Sponsors] | |||||
|
|
|
#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 |
|
|
||
|
|
|
#2 |
|
Guest
Posts: n/a
|
Look up "exception handling" in the documentation for your compiler. The implementation will vary from compiler to compiler.
|
|
|
||
|
|
|
#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 |
|
|
||
|
|
|
#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! |
|
|
||
|
|
|
#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! |
|
|
||
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Fortran Compiler-CFX12.1 | Araz | CFX | 11 | February 14, 2012 07:36 |
| 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 |