[Cfp-interest] Functions and infinity
Jim Thomas
jaswthomas at sbcglobal.net
Tue Jun 19 22:03:41 PDT 2018
> On Jun 17, 2018, at 5:48 PM, Fred J. Tydeman <tydeman at tybor.com> wrote:
>
> An action item I have had for some time.
>
> IEEE 754 vs 18661 (and C17) for infinity
>
> roundeven - ok
> round - ok
> trunc - ok
> ceil - ok
> floor - ok
> rint - ok
>
> nextup - ok
> nextdown - ok
> 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?
>
> 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.
> remquo - Not in 754.
remquo does provide a 754 operation, plus some more.
>
> quantize - ok
> quantum - ok
>
> scaleb - ok
> logb - ok
>
> fadd - ok
> fsub - ok
> fmul - ok
> fdiv - ok
> sqrt - ok
> fma - ok
> convertfromint - ok
>
> fromfp - ok
> ufromfp - ok
> fromfpx - ok
> ufromfpx - ok
> lround - ok
>
> canonicalize - ok
>
> scanf,... - ok
> printf,... - ok
>
> copy - ok
> negate - ok
> fabs - ok
> copysign - ok
>
> encode - ok
> decode - ok
>
> compares - ok
>
> is754* - ok
>
> fpclassify - ok (except for sign; except for qNaN vs sNaN)
Right. The 754 class operation is provided by combinations of C operations (fpclassify, signbit, and issignaling).
> signbit - ok
> isnormal - ok
> isfinite - ok
> iszero - ok
> issubnormal - ok
> isinf - ok
> isnan - ok
> issignaling - ok
> iscanonical - ok
> iseqsig - ok
> samequantum - ok
>
> radix - 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?
>
> *flags - ok
> *rounddir - ok
> *modes - ok
>
> ================
>
> exp - ok
> expm1 - ok
> exp2 - ok
> exp2m1 - ok
> exp10 - ok
> exp10m1 - ok
> log - ok
> log2 - ok
> log10 - ok
> logp1 - ok
> log2p1 - ok
> log10p1 - ok
> hypot - ok
> rsqrt - ok
> 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?
>
> 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.
>
> 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.
>
> 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.
> sin - ok
> cos - ok
> tan - ok
> sinpi - ok
> cospi - ok
> tanpi - ok
> asin - ok
> acos - ok
> atan - ok
> atan2 - ok
> asinpi - ok
> acospi - ok
> atanpi - ok
> atan2pi - ok
> sinh - ok
> cosh - ok
> tanh - ok
> asinh - ok
> acosh - ok
> atanh - ok
>
> 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”.
>
> reducsum - ok
> reducdot - ok
> reducsumsq - ok
> reducsumabs - ok
> scaledprod - ok
> scaledprodsum - ok
> scaledproddiff - ok
>
> 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.
> minnummag=fminmag - ok
> maxnummag=fmaxmag - ok
- Jim Thomas
>
>
> ---
> 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.
>
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest
More information about the Cfp-interest
mailing list