An illustrative code example in F90 using the available inf/nan tests is shown below (and is also available in the examples directory from a top-level install).
program test_isnan_isinf
use grvy
implicit none
real*8 :: should_be_nan
real*8 :: should_be_inf
real*8 :: m_one, one, zero
integer :: is_nan, is_inf
m_one = -1.d0
one = 1.d0
zero = 0.d0
should_be_nan = sqrt(m_one)
should_be_inf = one/zero
if( is_nan .eq. 1 )then
write(*,*) "NaN detected"
endif
if( is_inf .eq. 1 )then
write(*,*) "Inf detected"
endif
if( is_nan .eq. 1 )then
write(*,*) "NaN detected"
endif
if( is_inf .eq. 1 )then
write(*,*) "Inf detected"
endif
return
end program test_isnan_isinf