logical function isnan(a) real a if (a.ne.a) then isnan = .true. else isnan = .false. end if return end