[Fortran, Patch] PR 34192 - Fix compile-time evaluation of NEAREST
FX Coudert
fxcoudert@gmail.com
Sat Nov 24 11:28:00 GMT 2007
> PS: Any idea how to test for INF and NAN? If I do "0.0/0.0" I get a
> compile-time error and -fno-range-check does not help. I cannot assign
> to a variable first as otherwise NEAREST is not evaluated at
> compile time.
You should be able to get an NaN by 0. / 0. with -fno-range-check,
and same for Inf:
real, parameter :: x = 0. / 0.
real, parameter :: y = exp(log(huge(y))+20)
print *, x, y
end
>
PS: can someone confirm that the following is wrong?
$ cat a.f90
real, parameter :: y = exp(log(huge(y))+20)
real, parameter :: x = log(y)
print *, x, y
end
$ gfortran a.f90 -fno-range-check && ./a.out
108.72284 +Infinity
More information about the Fortran
mailing list