J3/17-129r2
To: J3
From: Malcolm Cohen
Subject: IEEE rounding modes badly described
Date: 2017 February 15
1. Introduction and discussion
The description of the rounding mode IEEE_AWAY is incorrect. This is
supposed to be what 60559 calls roundTiesToAway; that is, it rounds to the
nearest representable value, with ties rounding away from zero.
Furthermore, our description of IEEE_NEAREST is incomplete; it states that
it rounds to nearest, but not that it rounds ties to the even value, i.e.
that it is the what 60559 calls roundTiesToEven.
Finally, we say that
"...60559 specifies fives possible modes for rounding:
- IEEE_NEAREST ..."
which is completely wrong. 60559 does not specify ANY rounding mode which
it calls IEEE_NEAREST (or IEEE_UP etc.).
This needs to be completely rewritten, so that we use the 60559 terms for
the rounding modes (which it calls rounding-direction attributes - unlike
the 1970s version, it does not in principle have to be a "mode"), and
state directly what our parameter names correspond to.
It is arguable that we should use the 60559 terms throughout when we are
talking about the rounding modes, sorry rounding-direction attributes,
instead of our PARAMETER names. However, this paper does not advocate
that.
2. Edits to 17-007
[448:30-31] 17.2 Derived types, constants, and operators defined in the
modules, p3, second bullet,
change "and IEEE_AWAY ... mode."
to "IEEE_AWAY, and IEEE_OTHER for the rounding modes specified
in 17.4 ["The rounding modes"].",
making that whole sentence read
"Its only possible values are those of named constants defined in the
module: IEEE_NEAREST, IEEE_TO_ZERO, IEEE_UP, IEEE_DOWN, IEEE_AWAY, and
IEEE_OTHER for the rounding modes specified in this document."
{The rounding modes are now specified in this document, not in 60559,
even though in reference to 60559's rounding-direction attributes.}
[450:31] 17.4 The rounding modes, p1,
Change "ISO/IEC/IEEE 60559:2011" to "This document".
{60559 no longer specifies rounding modes, but we want to (to preserve
semantics of existing code).}
[451:4-10] Replace entire p2 "ISO/IEC... binary floating-point." with
"ISO/IEC/IEEE 60559:2011 specifies five possible rounding-direction
attributes: roundTiesToEven, roundTowardZero, roundTowardPositive,
roundTowardNegative, and roundTiesToAway. These correspond to the
rounding modes IEEE_NEAREST, IEEE_TO_ZERO, IEEE_UP, IEEE_DOWN, and
IEEE_AWAY respectively. The rounding mode IEEE_OTHER does not
correspond to any ISO/IEC/IEEE 60559:2011 rounding-direction
attribute; if supported, the effect of this rounding mode is
processor dependent."
{Attach our rounding modes to the 60559 specifications, except for
IEEE_OTHER which is completely processor dependent.}
[451:20+] Same subclause, after p5, before NOTE 17.4, insert new note
"NOTE 17.3a
ISO/IEC/IEEE 60559:2011 requires support for roundTiesToAway only for
decimal floating-point."
{This quirk is worth a note, but no more. For us, they are all processor
dependent anyway.}
[451:20++] Same subclause, new note
"NOTE 17.3b
ISO/IEC/IEEE 60559:2011 requires that there is a language-defined means
to specify a constant value for the rounding-direction attribute for all
standard operations in a block. The means provided by this document are
a CALL to IEEE_GET_ROUNDING_MODE at the beginning of the block followed
by a CALL to IEEE_SET_ROUNDING_MODE with constant arguments, together
with another CALL to IEEE_SET_ROUNDING_MODE at the end of the block to
restore the rounding mode."
{Document how we satisfy this 60559 requirement. It's ugly, but it does
satisfy it.}
[540:16+] Annex A, after bullet "the initial rounding modes (17.4);",
insert new bullets
"- whether the processor supports a particular rounding mode (17.4);
- the effect of the rounding mode IEEE_OTHER, if supported (17.4);"
{These have always been processor dependent, but not clearly documented
as such.}
===END===