[Cfp-interest 1250] Re: SNAN question

Jim Thomas jaswthomas at sbcglobal.net
Mon Feb 4 12:02:01 PST 2019



> On Feb 3, 2019, at 11:18 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> Is
> 
> static float f = -SNANF;
> 
> required / allowed / prohibited  to be a signaling NaN?
> 
> 
> 7.12#7 has:
> 
> If a signaling NaN macro is used
> for initializing an object of the same type that has 
> static or thread-local storage duration, the
> object is initialized with a signaling NaN value.

This specification seems ambiguous. Does “is used for initializing” include being in any expression that is used as an initializer, or just being the initializer? The former would include not only -SNANF but also 1.0 + SNAN. I think our intention was the latter. Assuming so, then the original example would allow but not require a signaling NaN result. To make this intention clear, we could change 7.12#7 to 

If a signaling NaN macro is used as the initializer
for initializing an object of the same type that has 
static or thread-local storage duration, the
object is initialized with a signaling NaN value.

- Jim Thomas


> 
> 
> ---
> 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.
> 
> _______________________________________________
> 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