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

Test values of for nan / infinity

ingo_berg
Beginner
1,629 Views
Hi,

is there a way to test if an array contains a nan or inf value without explicitely looping over all its elements? Will an isnan(maxval(diff)) or isnan(minval(diff)) do the trick?

All fortran books i have available here do not mention the isnan function at all instead they use ieee_is_nan . Is isnan a nonstandard extension?

What do I use in order to test for +/-inf
0 Kudos
1 Reply
Steven_L_Intel1
Employee
1,629 Views
isnan is an extension. Not until F2003 is there a standard spelling for this function.

There is inconsistency among implementations about what is done with max and min when one of the values is an "exceptional value". I would not depend on it.

Intel Fortran also supports an FP_CLASS intrinsic, again an extension, which can be used to test for all kinds of IEEE exceptional values.
0 Kudos
Reply