J3/05-109r1 Date: 29 Jan 2005 To: J3 From: John Reid Subject: inf/0.0, NaN/0.0 Here is a draft response for F03/0030, with thanks to Malcolm Cohen for his help. NUMBER: F03/0030 TITLE: IEEE divide by zero KEYWORDS: IEEE-754, divide-by-zero DEFECT TYPE: Erratum STATUS: For consideration 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 IEEE-754). The definitions in 14.2 were intended to describe IEEE exceptions with sufficient latitude to allow use on near-IEEE and non-IEEE machines. However, the definition of IEEE_DIVIDE_BY_ZERO is not consistent with the IEEE International Standard. Furthermore, the definition of the IEEE_OVERFLOW flag is also not consistent with the IEEE standard, because this exception is not raised for operations on infinite operands. Edits are provided to fix these inconsistencies. EDITS: Page and line numbers refer to 04-007. [365:13-15] Clause 14.2, lines 3 and 5. After "assignment" add "with finite operands", twice. [365:18] Clause 14.2, line 8. Change "nonzero numerator" to "finite nonzero numerator". SUBMITTED BY: Fred Tydeman HISTORY: 05-109 m171 Submitted 05-109r1 m171 Revised to include IEEE_OVERFLOW.