Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

detect NaN

huanghe
Beginner
1,178 Views
In the fortran, how to detect "NaN", "....", "???" apearing for a real variable and to stop the running of the code immediately after detecting it?
0 Kudos
1 Reply
Steven_L_Intel1
Employee
1,178 Views
If you want to test in code for a NaN, use the intrinsic function ISNAN. (This is an extension - a future version will support the F2003 standard routine for this purpose.)

If you want the program to stop automatically when a NaN is seen, then change the Floating Point Exception behavior to /fpe:0.
0 Kudos
Reply