In most fortran compilers, like gfortran, in order to identify little old nans, you would check by doing some sort of equivalency test, utilising the fact that nan is not self-equivalent. For example, if nanny=nan, then (nanny/=nanny) should output T. So, for the following code:
program test_nan
implicit none
real :: nanny,zero=0.0
nanny=zero/zero
print*,nanny
if (nanny/=nanny) then
print*,"found by self-equivalency"
else
print*,"not found by self-equivalency"
end if
if (nanny-1==nanny) then
print*,"found by perpetual transigence"
else
print*,"not found by perpetual transigence"
end if
if (nanny>1000000000000.0) then
print*,"found by big number"
else
print*,"not found by big number"
end if
end program
If I compile this in gfortran and run, I get:
NaN
found by self-equivalency
not found by perpetual transigence
not found by big number
But, doing the same with nvfortran gives:
NaN
not found by self-equivalency
not found by perpetual transigence
not found by big number
Is there a way in nvfortran that I can check for nans?