[Cfp-interest 2329] Re: infinity and exceptions

Jim Thomas jaswthomas at sbcglobal.net
Fri Jan 14 16:37:44 PST 2022



> On Jan 14, 2022, at 3:42 AM, Vincent Lefevre <vincent at vinc17.net> wrote:
> 
> On 2022-01-13 21:06:35 -0800, Fred J. Tydeman wrote:
>> On Fri, 14 Jan 2022 14:22:00 +1100 (AEDT) Damian McGuckin wrote:
>>> 
>>> On Thu, 13 Jan 2022, Fred J. Tydeman wrote:
>>>> 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.
> 
> OK for me.
> 
>>> Yes. But then again, how do you evaluate NAN?
> 
> Just like any expression.

I don’t see where C mentions evaluating a macro. Might need to say something like “The evaluation of the expanded macro does not raise floating-point exceptions.

However, this seems like a new proposal. For the list of things to consider for the next revision?

- Jim Thomas

> 
>>> You can assign it.
> 
> Other things can be done, not just assignments. Even
> 
>  (void) NAN;
> 
> is an evaluation.
> 
>> I have been sent the output of a program that did
>>  float f;
>>  f = NAN;
>> and the raised overflow, inexact, and invalid.
>> My guess:  It appears that NAN was defined as (INFINITY * 0.f)
>> and INFINITY was defined as (LDBL_MAX * LDBL_MAX)
> 
> Indeed, that's incorrect, concerning the exceptions, but also
> the values when rounding toward zero could be used (one would
> get LDBL_MAX for INFINITY and 0 for NAN), and the types too.
> 
> -- 
> Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest




More information about the Cfp-interest mailing list