How could I get constants (or parameter
s, I suppose) that are negative and positive infinity in Fortran 2008? I tried the following code:
program inf
use, intrinsic :: ieee_arithmetic
real(8), parameter :: inf_pos = ieee_value(0d0, ieee_positive_inf)
real(8), parameter :: inf_neg = ieee_value(0d0, ieee_negative_inf)
end program inf
However, I get the following errors:
$ gfortran inf.f08
inf.f08:4:22:
real(8) :: inf_pos = ieee_value(0d0, ieee_positive_inf)
1
Error: Function ‘ieee_value’ in initialization expression at (1) must be an intrinsic function
inf.f08:5:22:
real(8) :: inf_neg = ieee_value(0d0, ieee_negative_inf)
1
Error: Function ‘ieee_value’ in initialization expression at (1) must be an intrinsic function
Despite documentation saying otherwise, it seems that gfortran thinks that ieee_value()
isn't intrinsic.
Is there anyway to get what I'm trying to do?