[Cfp-interest] bool b = SNAN;

James W Thomas jaswthomas at sbcglobal.net
Thu Jun 13 08:43:41 PDT 2013


On Jun 13, 2013, at 7:47 AM, "Fred J. Tydeman" <tydeman at tybor.com> wrote:

> On Wed, 12 Jun 2013 19:58:32 -0700 James W Thomas wrote:
>> 
>> 
>> On Jun 12, 2013, at 12:28 PM, Fred J. Tydeman <tydeman at tybor.com> wrote:
>> 
>>> My understanding of C11 along with our CFP part 1, is that
>>> bool b = SNAN;
>>> 'b' shall have the value 1, and 'invalid' shall not be raised.
>> 
>> Invalid may be raised, depending on the implementation's support for signaling
>> NaNs.
>> 
>>> 
>>> C11 6.3.1.2 is where I get the value 1.
>>> C11 F.4 is where I get no 'invalid'.
>> 
>> The statement in F.4 doesn't apply to signaling NaNs, because in Annex F
>> unqualified NaN means quiet NaN.
> 
> In that case, seems like it would be much clearer if F.4 said:
> If the integer type is _Bool, 6.3.1.2 applies and
> no floating-point exceptions are raised
> for values other than signaling NaN.

Following the language in frexp, that might be:

If the integer type is _Bool, 6.3.1.2 applies and the conversion raises no floating-point exceptions if the floating-point value is not a signaling NaN.

-Jim
> 
> 
> ---
> Fred J. Tydeman        Tydeman Consulting
> tydeman at tybor.com      Testing, numerics, programming
> +1 (775) 287-5904      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