+++ This bug was initially created as a clone of Bug #13658 +++ sincosf() is inaccurate for large inputs on x86_64: with glibc 2.13, #define _GNU_SOURCE #include <stdio.h> #include <math.h> int main (void) { volatile float x = 1.0e22; float s1, s2, c1; sincosf (x, &s1, &c1); s2 = sinf (x); printf ("s1 = %.17g\n", s1); printf ("s2 = %.17g\n", s2); return 0; } outputs: s1 = 0.28122705221176147 s2 = 0.28122705221176147 Correct value: 0.85220084976718879
This applies to sinf, cosf, tanf and sincosf.
This applies only to x86 - and better use 0x1p65 as exact input value, the result is: 0.047236487235904796.
Fixed in git head: 2012-03-15 Andreas Jaeger <aj@suse.de> [BZ #13852] * sysdeps/i386/fpu/e_rem_pio2f.c: Delete so that i386 uses the ieee754/flt-32 implementation for sin, cos and sincos. * sysdeps/i386/fpu/k_rem_pio2f.c: Likewise. * sysdeps/i386/fpu/s_cosf.S: Likewise. * sysdeps/i386/fpu/s_sincosf.S: Likewise. * sysdeps/i386/fpu/s_sinf.S: Likewise. * sysdeps/i386/fpu/s_tanf.S: Delete so that i386 uses the ieee754/flt-32 implementation for tan. * math/libm-test.inc (cos_test): Enable some large input tests for float as well (sin_test): Likewise. (sincos_test): Likewise. (tan_test): Add tests for large input. * sysdeps/i386/fpu/libm-test-ulps: Update.