"make check" problems on MIPS
Hartvig Ekner
hartvige@mips.com
Mon Apr 8 08:31:00 GMT 2002
In my quest to get "make check" on MIPS to zero errors, I have
stumbled onto something strange:
Output from math/test-float:
Failure: Real part of: cacos (inf + NaN i) == NaN + inf i plus sign of zero/inf
not specified: Exception "Invalid operation" set
Failure: Real part of: cacos (-inf + NaN i) == NaN + inf i plus sign of zero/inf
not specified: Exception "Invalid operation" set
Failure: Real part of: cacos (NaN + inf i) == NaN - inf i: Exception "Invalid op
eration" set
Failure: Real part of: cacos (NaN - inf i) == NaN + inf i: Exception "Invalid op
eration" set
Failure: Real part of: cacos (NaN + NaN i) == NaN + NaN i: Exception "Invalid op
eration" set
(and then 8 more errors of the same kind with other functions).
The code in libm-test.c looks like this:
* TEST_c_c (cacos, plus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
* TEST_c_c (cacos, minus_infty, nan_value, nan_value, plus_infty, IGNORE_ZERO_INF_SIGN);
TEST_c_c (cacos, 0, nan_value, M_PI_2l, nan_value);
TEST_c_c (cacos, minus_zero, nan_value, M_PI_2l, nan_value);
* TEST_c_c (cacos, nan_value, plus_infty, nan_value, minus_infty);
* TEST_c_c (cacos, nan_value, minus_infty, nan_value, plus_infty);
...
* TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
The ones with "*" are the ones that fail.
It looks like the failure comes from the code in __cacosf, which has:
__complex__ float
__cacosf (__complex__ float x)
{
__complex__ float y;
__complex__ float res;
y = __casinf (x);
__real__ res = (float) M_PI_2 - __real__ y;
__imag__ res = -__imag__ y;
return res;
}
Note that the calculations performed after the call to __casinf will,
correctly I believe, generate Invalid operation exceptions ("-" on NaN).
So this raises two questions:
1) Is this a bug in __cacosf?
2) Why does this pass on x86?
(I didn't build all of glibc, but ran test-float separately, and it
passed).
Note: I tried to fix __cacosf to test for NaN results from __casinf before doing
the final calculations, and that fixed the issue. There are similar
problems in at least 4 files: s_cacos[f].c, s_cpow[f].c.
/Hartvig
More information about the Libc-alpha
mailing list