J3/17-230
To: J3
From: Malcolm Cohen
Subject: IEEE_REM clarification
Date: 2017 October 12
1. Introduction
The description of IEEE_REM is a bit confusing:
(a) the short description in 17.9 calls it "rem", but that is not
its name (its "remainder");
(b) the Result Value description only works for finite objects, and
only for nonzero Y;
(c) unlike the other IEEE_* functions that implement 60559 operations,
there is no mention of what, if any, signals.
Edits are provided to correct these.
2. Edits to 17-007r2 (N2137)
[453:9] 17.9 IEEE arithmetic, p1, 4th bullet,
"IEEE operation rem" -> "IEEE operation remainder".
{That's what it is called.}
[467:33-35] 17.11.31 IEEE_REM (X, Y), p6 Result Value,
Move the last sentence "This function computes..." to be the
first sentence of the subclause, and insert a paragraph break.
{Then everyone with the IEEE standard can stop reading before we launch
into repeating the gory details of the IEEE standard.
Breaking this up into several paragraphs will help avert the dreaded
"wall of incomprehensible text" syndrome.}
[467:33] Was same paragraph, will be a new one (p7).
Between "The result value" and ",",
insert "when X and Y are finite, and Y is nonzero".
{Description is fine for these cases only.}
[467:35+] Insert a new paragraph (will be p8).
"When X is finite and Y is infinite, the result value is X. If Y is
zero or X is infinite, and neither is a NaN, the IEEE_INVALID
exception shall occur; if IEEE_SUPPORT_NAN(X+Y) is true, the result is
a NaN. If X is subnormal and Y is infinite, the IEEE_UNDERFLOW
exception shall occur. No exception shall signal if X is finite and
normal, and Y is infinite.".
{Specify result value for X or Y infinite, and for Y nonzero.
Also specify the exceptions.}
This makes the whole Result Value paragraph, qua non-ASCII maths, read:
Result Value. This function computes the remainder operation specified in
ISO/IEC/IEEE 60559:2011.
The result value when X and Y are finite, and Y is nonzero, regardless of
the rounding mode, shall be exactly X - Y*N, where N is the integer
nearest to the exact value X/Y; whenever |N - X/Y| = 1/2 , N shall be
even. If the result value is zero, the sign shall be that of X.
When X is finite and Y is infinite, the result value is X. If Y is zero
or X is infinite, and neither is a NaN, the IEEE_INVALID exception shall
occur; if IEEE_SUPPORT_NAN(X+Y) is true, the result is a NaN. If X is
subnormal and Y is infinite, the IEEE_UNDERFLOW exception shall occur.
No exception shall signal if X is finite and normal, and Y is infinite.
===END===