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




On 6/30/2014 12:31 PM, FX wrote:
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



D:\fortran\ieee>a
         Infinity        -Infinity
         Infinity        -Infinity
          -1          -1
--
Brad Finney
Professor, Environmental Resources Engineering
Humboldt State University, Arcata, CA  95521
707.826.3918


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