首页 > 解决方案 > Fortran 将 NaN 设置为零

问题描述

有没有办法在 Fortran90 中将 NaN(不是数字)设置为零

program testnan
implicit none

real :: x,y
x = -1
y = sqrt(x)
if(y.lt.0)then
y = 0
end if

print*, x, y

end program testnan

我尝试了一些测试,但找不到解决方案。

标签: fortran

解决方案


推荐阅读