[hjl@gnu-13 tmp]$ cat y.c #include <stdio.h> #include <math.h> int main () { printf ("%.20e\n", cos (7.8544528e+04)); printf ("%.20e\n", cosf (7.8544528e+04)); } [hjl@gnu-13 tmp]$ gcc -O2 y.c -lm [hjl@gnu-13 tmp]$ ./a.out -7.28725145449983058125e-04 2.52127205021679401398e-03 [hjl@gnu-13 tmp]$
Failure: Test: cos (0X1.32D0875AC4074P+16) == -0X1.CA51FDD2C46CCP-40 Result: is: 2.52127205021679401398e-03 0x1.4a77da00000000000000p-9 should be: -1.62828073507065296255e-12 -0x1.ca51fe00000000000000p-40 difference: 2.52127205021679401398e-03 0x1.4a77da00000000000000p-9 ulp : 23254630125273088.0000 max.ulp : 0.0000
Suspended until somebody comes up with the patch.
When the given 0X1.32D0875AC4074P+16 is rounded to float you get 0X1.32D088P+16 and cos of that value, correctly rounded to float, is exactly the value cosf gives.