[Cfp-interest 1251] Re: SNAN question
Fred J. Tydeman
tydeman at tybor.com
Mon Feb 4 13:55:23 PST 2019
On Mon, 4 Feb 2019 12:02:01 -0800 Jim Thomas wrote:
>
>> 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.
Agreed.
>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.
clang appears to allow any expression with an SNAN macro as being an SNAN.
gcc appears to only allow SNAN, +SNAN, -SNAN as being an 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.
Or, perhaps:
If a (optionally signed) 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.
Since unary minus does not trigger an SNAN, it seems that -SNAN
should be valid where ever SNAN is allowed.
---
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