This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: ieee on Windows problem


> OK, all of the test programs EXCEPT ieee_2.f90 execute successfully.

Nice!


> ieee_2.f90 crashes on the following line
>  if (ieee_class(ieee_logb(-sx1)) /= ieee_positive_inf) call abort

Can you tell me what the following program outputs? (compiled with no optimization and the IEEE flags)

  use, intrinsic :: ieee_arithmetic
  real :: sx1

  sx1 = ieee_value(sx1, ieee_positive_inf)
  print *, sx1, -sx1
  print *, ieee_logb(sx1), ieee_logb(-sx1)
  print *, exponent(sx1), exponent(-sx1)

  end

For me, on x86_64-apple-darwin, it shows:

         Infinity        -Infinity
         Infinity         Infinity
           0           0

which is, by my reading, correct for IEEE_LOGB, but incorrect for the pre-existing EXPONENT intrinsic ("If X is an IEEE infinity or NaN, the result has the value HUGE(0)”).


FX

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