[Cfp-interest] Look into the consistency with our TS and IEEE-754

David Hough CFP pcfp at oakapple.net
Mon Jan 8 19:45:48 PST 2018


> Look into the consistency with our TS and IEEE-754:
> 2018 for 5.3.2, 9.2, 9.2.1, 9.2.2 and 9.4.

I took a look and appreciated why somebody would like to delegate this task.
Special value and exception information is organized differently in 754 and
CFP TS's.

I looked at n1940.pdf for chapter 9 and n1924.pdf for 5.3.2
and C1x for pow.
Here's what I noted - these might not be bugs.
I might have looked in the wrong places.

1) 7.12.4.14 TS has tanpi, 754 does not.    
 754 chose not to define tanPi - problems
 defining signs of exact zero and infinity results.

2) 7.12.4.11 atan2pi 
 TS: "A domain error may occur if both arguments are zero"
 754: no exception if both arguments zero

3) 7.12.6.16 
 TS: exp10m1 can't underflow, unlike exp2m1
 754: exp10m1 and exp2m1 can both underflow

*) F10.4.4 pow in C1x 30 Mar 2011:

I think I verified that these are equivalent, but it would be a lot
more obvious if the C spec followed 754 precisely.
I had to move the lines around to verify that they specified the same.

 C:
 pow(+-0, y) returns +-inf and raises the ??divide-by-zero?? floating-point exception for y an odd integer < 0.
 pow(+-0, y) returns +inf and raises the ??divide-by-zero?? floating-point exception for y < 0, finite, and not an odd integer.
 pow(+-0, y) returns +-0 for y an odd integer > 0.
 pow(+-0, y) returns +0 for y > 0 and not an odd integer.

 pow(+-0, -inf) returns +inf and may raise the ??divide-by-zero?? floating-point exception.
 pow(x, y) returns a NaN and raises the ??invalid?? floating-point exception for finite x < 0 and finite non-integer y.

 pow(-1, +-inf) returns 1.
 pow(+1, y) returns 1 for any y, even a NaN.
 pow(x, +-0) returns 1 for any x, even a NaN.
 pow(x, -inf) returns +inf for | x | < 1.
 pow(x, -inf) returns +0 for | x | > 1.
 pow(x, +inf) returns +0 for | x | < 1.
 pow(x, +inf) returns +inf for | x | > 1.
 pow(-inf, y) returns -0 for y an odd integer < 0.
 pow(-inf, y) returns +0 for y < 0 and not an odd integer.
 pow(-inf, y) returns -inf for y an odd integer > 0.
 pow(-inf, y) returns +inf for y > 0 and not an odd integer.
 pow(+inf, y) returns +0 for y < 0.
 pow(+inf, y) returns +inf for y > 0.


754:
 pow (+-0, y) is +-inf and signals the divideByZero exception for y an odd integer < 0
 pow (+-0, y) is +inf and signals the divideByZero exception for finite y < 0 and not an odd integer
 pow (+-0, y) is +-0 for finite y > 0 an odd integer 
 pow(+-0, y) is +0 for finite y > 0 and not an odd integer

 pow (+-0, -inf) is +inf with no exception 
 pow (+-0, +inf) is +0 with no exception

 pow(x, y) signals the invalid operation exception for finite x < 0 and finite non-integer y.

 pow (x, +-0) is 1 for any x (even a zero, quiet NaN, or infinity)
 pow (-1, +-inf) is 1 with no exception
 pow (+1, y) is 1 for any y (even a quiet NaN)
 pow (x, +inf) is +0 for -1 < x < 1
 pow (x, +inf) is +inf for x < -1 or for 1 < x (including +-inf)
 pow (x, -inf) is +inf for -1 < x < 1
 pow (x, -inf) is +0 for x < -1 or for 1 < x (including +-inf)
 pow (+inf, y) is +0 for a number y < 0
 pow (+inf, y) is +inf for a number y > 0
 pow (-inf, y) is -0 for finite y < 0 an odd integer 
 pow (-inf, y) is -inf for finite y > 0 an odd integer
 pow (-inf, y) is +0 for finite y < 0 and not an odd integer
 pow (-inf, y) is +inf for finite y > 0 and not an odd integer 

4) 7.12.7.10 powr
 TS: no error for +inf**0 and +1**inf
 754: invalid for +inf**0 and +1**inf

5) 7.12.13b.4 reduc_sumprod
 C: "The reduc_sumprod functions return the computed sum"
should that be 
"The reduc_sumprod functions return the computed dot product" ?

Dot product is a sum, but don't want to confuse with reduc_sum.

6) 754 9.2.2 preferred exponents
 The preferred quantum exponents table in n1924 doesn't have
 754's 9.2.2 entries for rsqrt, compound, rootn, pown, powr




More information about the Cfp-interest mailing list