I’ve been using isnanf and isinff (both PGI intrinsics, I think) to catch floating point errors in some code I’m using. But since they are PGI-specific, I can’t port the code over to other compilers.
Are the following tests correct, compiler-agnostic, equivalents to isnanf and isinff?
isnanf(foo) --> foo .ne. foo ! NaNs are not equal to themselves isinff(foo) --> (foo*0.d0) .ne. 0.d0 ! Infs are nonzero when ! multiplied by zero