J3/10-238r1
To: J3
From: Malcolm Cohen
Subject: IEEE divide by zero
Date: 2010 October 13
----------------------------------------------------------------------
NUMBER: F03/0030
TITLE: IEEE divide by zero
KEYWORDS: IEEE-754, divide-by-zero
DEFECT TYPE: Erratum
STATUS: J3 consideration in progress
QUESTION:
Is infinity / 0.0 a divide by zero exception?
Is NaN / 0.0 a divide by zero exception?
Fortran 2003 defines (in 14.2) infinity / zero and NaN / zero
cases as IEEE_DIVIDE_BY_ZERO. IEEE-754 defines (in 6.1 and 6.2)
those two as unexceptional.
ANSWER:
On an IEEE-conformant processor, these cases do not raise exceptions
(see clauses 6.1 and 6.2 of IEC 60559:1989).
The definitions in 14.2 were intended to describe IEC 60559:1989
exceptions with sufficient latitude to allow use on machines that do
not conform to IEC 60559:1989. However, the definition of
IEEE_DIVIDE_BY_ZERO is not consistent with IEC 60559:1989.
Furthermore, the definition of the IEEE_OVERFLOW flag is also not
consistent with IEC 60559:1989, because this exception is not raised
for operations on infinite operands.
Additionally, if the data type is not an IEEE data type, but the
exception is supported, the circumstances under which the exception is
raised are processor dependent.
Edits are provided.
EDITS:
Page and line numbers refer to 10-007.
[403:7-9] Clause 14.3, first paragraph, first bullet (IEEE_OVERFLOW),
Replace with
"IEEE_OVERFLOW occurs in an intrinsic real addition, subtraction,
multiplication, division, or conversion by the intrinsic function
REAL, as specified by IEC 60559:1989 if IEEE_SUPPORT_DATATYPE is
true for the result of the operation or conversion, and as
determined by the processor if IEEE_SUPPORT_DATATYPE for the result
is not true. It occurs in an intrinsic real exponentiation as
determined by the processor. It occurs in a complex operation, or
conversion by the intrinsic function CMPLX, if it is caused by the
calculation of the real or imaginary part of the result."
[403:10-11] Replace with
"IEEE_DIVIDE_BY_ZERO occurs in a real division as specified by IEC
60559:1989 if IEEE_SUPPORT_DATATYPE is true for the result of the
division, and as determined by the processor if
IEEE_SUPPORT_DATATYPE for the result is not true. It is
processor-dependent whether it occurs in a real exponentiation with
a negative exponent. It occurs in a complex division if it is
caused by the calculation of the real or imaginary part of the
result."
[462:24+] Insert new bullet points
"- the conditions under which IEEE_OVERFLOW is raised in a
calculation involving non-IEC 60559:1989 floating-point data;
- the conditions under which IEEE_OVERFLOW and IEEE_DIVIDE_BY_ZERO
are raised in a floating-point exponentiation operation;
- the conditions under which IEEE_DIVIDE_BY_ZERO is raised in a
calculation involving non-IEC 60559:1989 floating-point data;"
SUBMITTED BY: Fred Tydeman
HISTORY: 05-109 m171 F03/0030 submitted
05-109r1 m171 Revised to include IEEE_OVERFLOW,
Passed by J3 meeting
05-170 m172 Passed J3 letter ballot #11
N1622 m172 Failed WG5 ballot N1629
10-nnn m193 Revised answer.
----------------------------------------------------------------------