The version of powf() in sysdeps/ieee754/flt-32/e_powf.c gives results that are wrong by more than 1 ulp for at least some inputs. The testcase below will demonstrate the problem for powf(-1.100000e +00, 1.010000e+02). The output from this test on an x86_64 platform running RH Enterprise 3 is: inputs: a = -1.100000e+00 b = 1.010000e+02 actual = -1.5158703e+04 (0xc66cdad0) expected = -1.5158707e+04 (0xc66cdad4) pow(a, b) = -1.5158706757936e+04 The actual value is off by 4 ulp from the expected value, so the absolute error must be at least 3 ulp. Other math libraries derived from fdlibm (e.g., newlib) have the same problem. The test program is: #include <stdio.h> #include <math.h> unsigned int ta = 0xBF8CCCCD; unsigned int tb = 0x42CA0000; main () { float a = *(float *)&ta; float b = *(float *)&tb; float c = powf(a, b); float d = pow(a, b); printf("inputs: a = %e b = %e\n", a, b); printf("actual =\t%.7e\t(0x%08x)\n", c, *(unsigned *)&c); printf("expected =\t%.7e\t(0x%08x)\n", d, *(unsigned *)&d); printf("pow(a, b) =\t%.13e\n", pow(a, b)); }
Once somebody provides a better implementation we can use it.
FYI, this is similar to bug 706 (on pow() inaccuracies, which are particularly visible for x ~ 1.0).
*** Bug 3407 has been marked as a duplicate of this bug. ***
Still present, should be added to the testsuite.
Collecting all reports of few-ulps errors together in one meta-bug. *** This bug has been marked as a duplicate of bug 14759 ***