J3/12-144 To: J3 From: Malcolm Cohen Subject: IEEE exceptions for intrinsic functions Date: 2012 February 16 ---------------------------------------------------------------------- NUMBER: F08/0008 TITLE: IEEE exceptions for intrinsic functions KEYWORDS: IEEE_INVALID, SQRT DEFECT TYPE: Interpretation STATUS: J3 consideration in progress QUESTIONS: Section 13.7.1, page 325, lines 10-12 states If an infinite result is returned, the flag IEEE_OVERFLOW or IEEE_DIVIDE_BY_ZERO shall signal; if a NaN result is returned, the flag IEEE_INVALID shall signal. Question (1): The Fortran 2008 standard does not require a standard-conforming processor to support IEEE_INVALID [14.3p8, 404:15]. If a processor does not support IEEE_INVALID, is it required to signal IEEE_INVALID when a NaN result is returned? Question (2): IEC 60559 requires the result of SQRT(+inf) to be +inf without overflow being signaled. IEC 60559 requires SQRT(qNaN), where qNaN is a quiet NaN, not to signal an invalid operand exception. Does Fortran 2008 require SQRT(QNaN) to signal IEEE_INVALID? ANSWERS: A1. No, if the processor does not support IEEE_INVALID, it cannot signal IEEE_INVALID. An edit is provided to clarify this. A2. No, the standard does not specify the behavior of SQRT on qNaN. EDITS to 10-007r1: [325:7] Change "is prohibited from invoking" to "shall not invoke". {Simpler wording is easier to understand.} [325:7-8] "returned in" -> "assigned to". {Correct wording instead of nonsense.} [325:8] After "or" insert "returned as a". {Continue correcting grammar.} [325:8-12] Replace "outside ... invoked" with "not representable by objects of the specified type and type parameters". [325:12+] Insert new paragraph "If an IEEE infinity is assigned or returned, the intrinsic module IEEE_ARITHMETIC is accessible, and the actual arguments were normal numbers, the flag IEEE_OVERFLOW or IEEE_DIVIDE_BY_ZERO shall signal. If an IEEE NaN is assigned or returned, the actual arguments were normal numbers, the intrinsic module IEEE_ARITHMETIC is accessible, and the exception IEEE_INVALID is supported, the flag IEEE_INVALID shall signal. If no IEEE infinity or NaN is assigned or returned, these flags shall have the same status as when the intrinsic procedure was invoked." SUBMITTED BY: Robert Corbett HISTORY: 10-155 m192 F08/0008 submitted 10-155r1 m192 Fix title 10-155r2 m192 Draft answer 10-155r3 m192 Revised answer - Passed by J3 meeting 10-202 m192 Passed by J3 letter ballot #21 10-199 N1878 m197 Failed WG5 ballot N1876 12-144 m197 Attempt to fix 13.7.1. ----------------------------------------------------------------------