[Cfp-interest] review draft for CFP TS Part 1 content

Jim Thomas jaswthomas at sbcglobal.net
Sun Jan 8 21:11:09 PST 2012


Thanks, Fred, Below are some shoot-from-the-hip comments. More generally, are we agreed that we should use C11 as a model for how to specify errors for the new functions we add?

-Jim 

On Jan 8, 2012, at 4:08 PM, Fred J. Tydeman wrote:

> On Wed, 4 Jan 2012 16:23:02 -0800 Jim Thomas wrote:
>> 
>> The errno requirements are not in yet. Fred, would you be
>> willing to list the errno changes you think are needed?
> 
> F.2.1 Infinities and NaNs
> Recommended practice
> Add at end of 1st paragraph: (and for functions, shall be a domain
> error).

There's currently nothing in Annex F about domain or range errors (as you note regarding the last item below).

The recommended practice applies to built-in operations as well as library functions. Built-in operations don't set errno.

Should signaling NaNs cause errno to be set? If so then we probably want to say so in the main library clause.

> 
> 7.12.6.7 The llogb functions
> Add at end of description:  and a domain error occurs.

The llogb words are the same as for ilogb. Do you think ilogb is wrong?

> 
> 7.12.14.1 Add and round to narrower type
> Add at end of description:  for finite arguments.  A domain error may
> occur for infinite arguments.

How about range errors? Likewise for the other narrowing functions below.

Do narrowing add, sub, mul, and div need to set errno? Setting errno would have a major performance cost on implementations with HW instructions that can deliver narrower results. The corresponding built-in operators don't set errno.

The current fma spec just says "A range error may occur." 

> 
> 7.12.14.2 Subtract and round to narrower type
> Add at end of description:  for finite arguments.  A domain error may
> occur for infinite arguments.
> 
> 7.12.14.3 Multiply and round to narrower type
> Add at end of description:  for finite arguments.  A domain error
> occurs for one infinite argument and one zero argument.
> 
> 7.12.14.4 Divide and round to narrower type
> Add at end of description:  for finite arguments.  A domain error
> occurs for either both arguments infinite or both arguments zero.  A
> pole error occurs for a finite x and a zero y.
> 
> 7.12.14.5 Floating multiply-add and round to narrower type
> Add at end of description:  for finite arguments.  A domain error
> may occur for an infinite argument.
> 
> 7.12.14.6 Square root and round to narrower type
> Add at end of description: for finite positive arguments.  A domain
> error occurs for negative arguments.
> 
> F.10.8.5 The canonicalize functions
> ISSUE:  SNaN => domain error?  No where else in Annex F is domain
> error mentioned.  

Right.

> But, if math errors are reported via both flags and
> errno, then error shall be set to EDOM.

Please say more.

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