08-287r1
To: J3
From: Steve Lionel
Subject: changes to the intrinsic function FRACTION
Date: 2008 November 19
Comment by Robert Corbett
The specification of the intrinsic function FRACTION
has been changed in CD 1539-1 in ways that make it
less clear than the specification in the Fortran 2003
standard.
The Fortran 2003 standard states (317:13.7.40l9)
If X is an IEEE NaN, the result is that NaN.
The CD 1539-1 specification states (348:13.7.63p5)
If X has the value zero or is an IEEE NaN,
the result has the same value as X.
It is unclear what it means for a NaN to have the
same value as another NaN. The description in
Fortran 2003 is clearer. I suggest restoring the
text to that of the Fortran 2003 standard.
The specification of Fraction leaves many important
questions unanswered.
Is it the intent of the committee that applying
FRACTION to a zero value on a processor that
distinguishes the sign of zero shall produce a
result that preserves the sign of that zero value?
If so, that seems to conflict with 52:4.4.3p3.
Is it the intent of the committee that the result
of applying FRACTION to a zero value should be the
same representation of a zero value? The IBM
mainframe architecture and the Intel architecture
with the DAZ bit set in the MXCSR provide many
different representations of zero.
It seems clear that the committee intends that the
result of applying FRACTION to a signaling NaN
should produce a result that is a signaling NaN.
For some processors, it is difficult to return a
signaling NaN.
J3's response:
J3 agrees that the CD wording is unclear and provides an edit
to resolve the issue. It is noted that RRSPACING and SPACING
use the "that NaN" text which FRACTION had in Fortran 2003; J3
feels that the issue of what a processor does when loading a
signaling NaN is beyond the scope of the standard.
Regarding signed zeroes, the intention is that FRACTION does
not distinguish between positive and negative zero. However, the
text in 52:4.4.3p3 does not discuss intrinsic function result
values but rather how a negative zero, if any, is treated as an
actual argument. Therefore there is no conflict.
Edit:
[348:5] In 13.7.63, replace:
"If X has the value zero or is an IEEE NaN, the result has the
same value as X."
with:
"If X has the value zero, the result is zero. If X is an IEEE NaN,
the result is that NaN."