This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Fortran, Patch] PR 34192 - Fix compile-time evaluation of NEAREST


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]