[Cfp-interest 2321] Re: infinity and exceptions

Fred J. Tydeman tydeman at tybor.com
Thu Jan 13 18:31:38 PST 2022


On Fri, 14 Jan 2022 00:31:00 +0100 Vincent Lefevre wrote:
>
>On 2021-12-28 20:09:46 -0800, Fred J. Tydeman wrote:
>> I wonder if we should change 5.2.4.2.2#4:
>> 
>> A quiet NaN propagates through almost
>> every arithmetic operation without raising a floating-point exception; a signaling NaN generally
>> raises a floating-point exception when occurring as an arithmetic operand..23)
>> 
>> to
>> 
>> Both infinity and a quiet NaN propagates through almost
>> every arithmetic operation without raising a floating-point exception; a signaling NaN generally
>> raises a floating-point exception when occurring as an arithmetic operand..23)
>
>Infinity does not propagate. A result may be an infinity, but
>not always, e.g. 1 / +inf = +0, and the sign may be different:
>0 - +inf = -inf.
>
>> I do not see any place in the C standard that the use of
>> INFINITY shall be quiet (in most cases).  One exception is
>> INFINITY / INFINITY (which raises invalid)..
>
>and 0 * INFINITY.
>

OK.  Wrong way to solve the problem I see.

How about adding to 5.2.4.2.2 #16 and #17:
16: The evaluation of INFINITY does not raise any FP exceptions.
17: The evaluation of NAN does not raise any FP exceptions.

---
Fred J. Tydeman        Tydeman Consulting
tydeman at tybor.com      Testing, numerics, programming
+1 (702) 608-6093      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.



More information about the Cfp-interest mailing list