[Cfp-interest 3031] Re: <math.h> macros and exceptions

Jim Thomas jaswthomas at sbcglobal.net
Fri Mar 8 16:21:23 PST 2024


Do we intend for the evaluation of any object-like macros defined in Clause 7 or Annexes F, G, H or K to raise a floating-point exception at execution time? If not, we might add that as a requirement in 7.1.2. See 7.1.2 #7 (in n3219).

> On Feb 11, 2024, at 9:58 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> On Wed, 7 Feb 2024 19:37:46 +0000 Rajan Bhakta wrote:
>> 
>>       Jim:  Are there any <math.h> macros with this issue?  Should words be added to an introduction section in <float.h>?
>>       ^Fred: Look into.
> 
> <math.h> macros that should not raise exceptions when evaluated:
> 
> HUGE_VAL, HUGE_VALF, HUGE_VALL, HUGE_VAL_D*
> INFINITY, DEC_INFINITY
> NAN, DEC_NAN
> 
> 
> Aside:  Should 7.12.1#5 (overflow) mention HUGE_VAL_D*?

Right. Perhaps change 

returns the value of the macro HUGE_VAL, HUGE_VALF, or HUGE_VALL according to the return type

to

returns the value of the macro HUGE_VAL suffixed according to the return type

which would cover the macros in Annex H too.

> 
> SNAN macro "requirement" is in a Recommended practice in F.2.1.

I think it's F.2.2 in n3219. It doesn't use “shall” or a form of “require”. Are you interpreting “raises” (in recommended practice) as a requirement?

> 
> FLTn_SNAN, DECn_SNAN, FLTnx_SNAN, DECnx_SNAN in H.3#6
> HUGE_VAL_Fn, HUGE_VAL_Dn, HUGE_VAL_Fnx, HUGE_VAL_Dnx in H.11.1
> 
> Aside:  5.2.4.2.2#22 mentions SNAN for translation time initializer,
> while H.3#6 mentions static or thread storage duration.

Good catch. I think it’s 5.2.5.3.2#28 in n3219. Is there any reason not to use the words in H.3#6 in both places? 

- Jim Thomas

> 
> 
> ---
> Fred J. Tydeman        Tydeman Consulting
> tydeman at tybor.com      Testing, numerics, programming
> +1 (702) 608-6093      Vice-chair of INCITS/C (ANSI "C")
> Sample C17+FPCE tests: http://www.tybor.com
> Savers sleep well, investors eat well, spenders work forever.
> 
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20240308/36835101/attachment.htm>


More information about the Cfp-interest mailing list