J3/05-114r1
Date: 29 Jan 2005
To: J3
From: John Reid
Subject: nextafter(+0.0,-0.0), nextafter(NaN,y)
Here is a draft response for F03/0035, with thanks to Malcolm Cohen
for his help.
NUMBER: F03/0035
TITLE: IEEE_NEXT_AFTER()
KEYWORDS: IEEE-754, nextafter()
DEFECT TYPE: Interpretation
STATUS: For consideration
QUESTION:
What is NEXT_AFTER(+0.0,-0.0)? NEXT_AFTER(-0.0,+0.0)?
What is NEXT_AFTER(X,Y) if X and/or Y is NaN?
C99 and IEEE-754R (the revision of IEEE-754 now in progress)
define NEXT_AFTER(X,Y) as Y (not X) when X == Y.
NEXT_AFTER(X,Y) when both X and Y are NaN shall be a NaN, and
should be one of NaN arguments.
NEXT_AFTER(X,Y) when one of X and Y is a NaN shall be a NaN, and
should the NaN argument.
ANSWER:
The first paragraph of 14.8 states "Complete conformance with the
is not required, but ... the functions copysign, scalb, logb,
nextafter, rem, and unordered shall be provided by the functions
IEEE_COPY_SIGN, IEEE_SCALB, IEEE_LOGB, IEEE_NEXT_AFTER, IEEE_REM,
and IEEE_UNORDERED."
For NEXT_AFTER(X,Y) with X == Y == 0, the result is X, see 14.10.13,
Case (i). This is the recommendation of the IEEE International
Standard. The current draft revision of that Standard uses the
definition copysign(x,y) in this case. We will reconsider the Fortran
definition of NEXT_AFTER if a revised IEEE Standard is adopted
with this change present.
The case of NEXT_AFTER(X,Y) when one or both of X and Y is a NaN
is as defined by the IEEE International Standard, see the words
from 14.8 quoted above.
EDITS: None.
SUBMITTED BY: Fred Tydeman
HISTORY: J3/05-114 m171 Submitted