subroutine test_nan(dat,is_nan) implicit none include 'max.inc' c c Purpose: to test whether the input double precision 'dat' c is a NaN or not. c c Input: c + dat (double precision) c c Output: c + is_nan: true if "dat" is a NaN c c I/O double precision dat logical is_nan c temp integer t1,t2 c label integer strlen character*(Nchar_mx) label label='subroutine test_nan' if (dat.le.0.0D+0) then t1=0 else t1=1 endif if (dat.ge.0.0D+0) then t2=0 else t2=1 endif is_nan=.false. if ((t1.eq.1).and.(t2.eq.1)) then is_nan=.true. endif return end