[Cfp-interest 1316] Re: First pass at SNAN questions

Jim Thomas jaswthomas at sbcglobal.net
Wed May 15 15:51:12 PDT 2019



> On Apr 24, 2019, at 2:31 PM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> On Wed, 24 Apr 2019 11:44:32 -0700 (PDT) Fred J. Tydeman wrote:
>> 
>> Attached is a first pass at the SNAN questions.  I still need to check the clause numbers.
> 
> Minor fixes.  Attached.
> 
> 
> ---
> Fred J. Tydeman        Tydeman Consulting
> tydeman at tybor.com <mailto: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 <http://www.tybor.com/>
> Savers sleep well, investors eat well, spenders work forever.
> 
> 
> Submitter:Fred Tydeman
> Submission Date: 2019-04-24
> Document: WG14 Nxxxx
> Reference Documents: CFP emails 1247, 1249, 1250, 1253
> 
> Summary
> 
> Since unary minus does not trigger an SNAN, it seems that -SNAN should be valid where ever SNAN is allowed.
> 
> Since -SNAN raises no floating-point exceptions, what about +SNAN?
> 
> Is +SNAN a copy operation?
> 
> The standard appears to be ambiguous as to what is a valid signaling NaN initializer.
> 
> Is static float f = -SNANF; {required / allowed / prohibited} to be a signaling NaN?
> 
> 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.
> 
> 
Consider starting the summary with the relevant text in 7.12: "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.” 

Consider avoiding the use of “valid”.

You might add that IEC 60559 rules evaluate 1.0 + SNAN to a quiet NaN and -SNAN to a signaling NaN.
> Possible Technical Corrigendum:
> 
> Change 7.12#7 from
> 
> 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.
> 
> to
> 
> If a signaling NaN macro (with an optional preceeding + or - sign)
> 
I don’t believe this is consistent with C terminology. How about “If an optional unary + or - operator followed by 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.
> 
> Change Annex F.3#1 Operation binding table: 'copy' from
> 
>     copy             memcpy, memmove,
> to
>     copy             memcpy, memmove, +(x)
> Change Annex F.3#4 from
> 
> The unary - operator raises no floating-point exceptions, even if the operand is a signaling NaN.
> 
> to
> 
> The unary - and + operator operators 
> 
Nit: other occurrence (6.5.3.3) in C has the + before the -.

- Jim Thomas
> raise no floating-point exceptions, even if the operand is a signaling NaN.
> 
> Existing practice
> 
> 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.
> 
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net <mailto:Cfp-interest at oakapple.net>
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest <http://mailman.oakapple.net/mailman/listinfo/cfp-interest>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20190515/8f083bc3/attachment-0001.html 


More information about the Cfp-interest mailing list