在 Fortran 中将变量设置为 +Infinity 的最安全方法是什么?目前我正在使用:
program test
implicit none
print *,infinity()
contains
real function infinity()
implicit none
real :: x
x = huge(1.)
infinity = x + x
end function infinity
end program test
但我想知道是否有更好的方法?