[Cfp-interest] Functions and infinity
Fred J. Tydeman
tydeman at tybor.com
Wed Jun 20 09:32:32 PDT 2018
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. 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.
754 in a few places adds infinity when the '>' or '<' could include it.
>> 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?
>> 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.
>> 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.
---
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