(j3.2006) FRACTION: zeros, infinities and NaNs

Robert Corbett Robert.Corbett
Fri Sep 19 00:05:52 EDT 2008


The specification of the intrinsic function FRACTION in
Section 13.7.40 of the Fortran 2003 standard states

     If X has the value zero, the result has the
     value zero.  If X is and IEEE infinity, the
     result is that infinity.  If X is an IEEE NaN,
     the result is that NaN.

The related language in Section 13.7.63 of CD 1539-1
states

      If X has the value zero or is an IEEE NaN,
      the result has the same value as X.  If X
      is an IEEE infinity, the result is an
      IEEE NaN.

The change in the treatment of IEEE infinities is an
incompatible change.  If it were an intentional change,
it would, of course, be listed as an incompatible
change in Section 1.5.2 of CD 1539-1.  Since it is not
listed in Section 1.5.2, I assume it is an unintended
change.

The change to the specification of the treatment of
IEEE NaNs is troubling.  It is unclear what it means
for NaNs to have the same value, given that NaNs have
no value.

Is the new wording regarding zeros intended to mean
that on a processor that distinguishes between zeros
with positive and negative signs, the sign must be
preserved?  If so, it should say so.  A zero value
with a positive sign and a zero value with a negative
sign both have the same value (zero).

The Fortran 2003 standard seems to say that if the
actual argument of a call of FRACTION is a signaling
NaN, that signaling NaN must be returned.  That could
be difficult to implement on some hardware.  Is that
really the intent?  Is FRACTION allowed to signal an
invalid exception if its actual argument is a
signaling NaN?

Bob Corbett




More information about the J3 mailing list