Bug#153548: libc6: Results of math functions are sometimes wrong
Vincent Lefevre wrote:
----------------------------<snip>-----------------------------------
#include <stdio.h>
#include <math.h>
int main (void)
{
double x, y;
x = 0.80190127184058835;
y = cos (x);
printf ("f(%.17g) = %.17g\n", x, y);
return 0;
}
gives
f(0.80190127184058835) = 0.71867942238767868
on my PowerPC machine (Titanium). The result should be something like:
f(0.80190127184058835) = 0.69534156199418473
-----------------------------<snip>----------------------------------
The funny thing about this is that the result is _exactly_ sin(x)
instead of cos(x). Furthermore, it seems to be a special case, as
slightly changing x gives correct results. Could it be a typo in some
special case handling for cos()? I can confirm the error here, but I
do not have the glibc sources handy to track the error down.
Cheers,
Lukas
Reply to: