[Cfp-interest] Functions and infinity

Jim Thomas jaswthomas at sbcglobal.net
Wed Jun 20 10:18:52 PDT 2018



> On Jun 20, 2018, at 9:32 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> On Tue, 19 Jun 2018 22:03:41 -0700 Jim Thomas wrote:
>> 
>>> remainder -
>>> 754: remainder(x,inf) for finite x;
>>> cfp: x not infinite
>>>  => x=NaN is different.
>> 
>> Aren't NaN argument cases handled globally, in both 754 and cfp?
> 
> C and cfp do for Annex F, but not main body of standard.
> 754 does, but requires a canonical quiet NaN result.
> 
> The difference here for remainder is:  cfp requires that if x is a NaN,
> that same NaN be returned.  

Hmm. Where does cfp say that?

> While 754 just requires than some NaN be returned.
> 
>>> 754: remainder(x,inf) for finite normal x
>>> cfp: x not infinite
>>> 
>>> 754: remainder(subnormal,inf) signals underflow
>>> cfp: x not infinite
>> 
>> Didn't we already discuss this? It's only with alternate exception handling that the underflow signal from remainder can be
>> detected.
> 
> Yes and agreed.
> 
>>> remquo - Not in 754.
>> 
>> remquo does provide a 754 operation, plus some more.
> 
> OK
> 
>>> 
>>> totalorder - differ for NaN payloads
>>> totalordermag - differ for NaN payloads
>> 
>> Right. I think we should loosen the P1 spec to match 754-201x.
>> 
>>> 
>>> payload - ok for inf; differ on error return
>> 
>> Intended to be the same. How to they differ?
> 
> In looking at the most recent working version of 18661-1, they now match.
> 
>>> compound -
>>> 754: compound(+inf,0) is 1
>>> cfp: not explicit
>> 
>> cfp says compoundn(x, 0) is 1 for x > -1. Doesn't that cover it?
> 
> Depends if "x >= -1" means just finite numbers
> or finite numbers and +infinity.

It means the latter in cfp docs.

> 754 in a few places adds infinity when the '>' or '<' could include it.

It might worth calling that to 754’s attention. It raises the question of what the domain for > and < are, as we’re dealing with here.
> 
>>> 754: compound(quiet NaN,0) is 1
>>> cfp: compound(NaN,0) is 1
>> 
>> Unqualified NaN means quiet NaN in cfp annex F. See P1 F.2.1#3.
> 
> Agreed.  Now that cfp is supporting signaling NaNs,
> should we consider a global change in C to match 754
> so that NaN means both quiet and signaling?

I hope we don’t need to do that. We put a lot of effort into P1 clause 12 to allow a C implementation to support signaling NaNs as in 754.
> 
>>> 754 is missing overflow and underflow
>>> rootn -
>>> 754 is missing rootn(+/-inf, n) special case
>>> rootn( 1, n ) special case missing from both
>>> rootn( 1, 0 ): is it covered by rootn(1,n) or rootn(x,0)?
>>> pown -
>>> 754 is missing pown(+/-inf, n) special case
>>> pow -
>>> 754: pow(qNaN,0)
>>> cfp: pow( NaN,0)
>> 
>> As above.
> 
> Agreed.
> 
>>> 754: pow(+/-0,-inf) no exception
>>> cfp: pow(+/-0,-inf) may raise div-by-zero
>> 
>> Hmm. Interesting case. The 754 spec follows from the 754 definition of divideByZero: the infinite operand precludes the
>> exception. However, it's not really the infiniteness of the second operand that causes the infinite result. Should we
>> changer to match 754?
>> 
>>> powr -
>>> cfp is missing powr(x,qNaN) is qNaN for x>=0
>>> cfp is missing powr(qNaN,y) is qNaN
>> 
>> Aren't these NaN cases covered globally.
> 
> Yes for powr(qNaN,y).  Not sure about powr(x,qNaN).
> 
>>> It appears to me that 754 requires intermediate computations to not
>>> overflow or underflow.  That contradicts [1] in 7.12.13b.
>> 
>> Right. We might need to change the "should" to a "shall".
>>> 
>>> 
>>> augadd - missing from cfp
>>> augsub - missing from cfp
>>> augmul - missing from cfp
>>> 
>>> min - missing from cfp
>>> max - missing from cfp
>>> minnummagnum - missing from cfp
>>> maxnummagnum - missing from cfp
>>> minnum=fmin - ok; differ for signed zeros
>>> maxnum=fmax - ok; differ for signed zeros
>> 
>> I'm confused by the names. I think the issue here is whether our min-max proposal for C support of 754-201x brings us in to
>> line with 754-201x.
> 
> I do not see any words in cfp that -0 < +0 for these functions.

Our spec  says "For these functions, +0 is considered greater than −0.” See 
http://wiki.edg.com/pub/CFP/WebHome/min-max_spec-20180615.pdf <http://wiki.edg.com/pub/CFP/WebHome/min-max_spec-20180615.pdf>
>>> minnummag=fminmag - ok
>>> maxnummag=fmaxmag - ok
> 
> 754-201x has 8 forms of max and min.
> c99/11/17 has 2 forms and cfp has 2 forms of max and min for a total of 4 forms.

See 
http://wiki.edg.com/pub/CFP/WebHome/min-max_spec-20180615.pdf <http://wiki.edg.com/pub/CFP/WebHome/min-max_spec-20180615.pdf>

- Jim

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20180620/d4bd6429/attachment-0001.html 


More information about the Cfp-interest mailing list