On Sun, 12 Feb 2012, Carlos O'Donell wrote:
On Thu, Feb 9, 2012 at 4:49 PM, Andreas Jaeger<aj@suse.com> wrote:
We should not use the inaccurate fsincos instruction on x86-64 (see bugzilla
and the discussion on the gcc mailing list). Let's just remove the double
version and use the IBM libm sincos implementation.
Unfortunately the same fix does not work for the long double version - since
there's no sincos implementation for ldbl-96 yet ;-(. Jakub, you wrote the
ldb-128 versions - do you have any suggestions?
What's actually missing is k_sinl.c / k_cosl.c. Apart from the bits
dealing with extracting integer values from the bits of a long double, you
could probably just reuse the ldbl-128 versions (the numbers in the tables
may have more decimal digits specified than needed, and approximations may
be computed with more terms than needed, but they should still work once
you fix up the integer bits).
2012-02-09 Andreas Jaeger<aj@suse.de>
[BZ#13658]
* sysdeps/x86_64/fpu/s_sincos.S: Remove, let's not use the
inaccurate fsincos instruction.
Is there any reason we don't do long-form argument reduction (as
normal sin and cos do) followed by fsincos?
The long-form reduction actually produces a sum of two values rather than
just a single reduced value, for greater accuracy (although not correctly
rounded results). I don't know how accurate fsincos is for reduced values
(and if it agrees with fsin and fcos on those values, which was the issue
in the gcc list discussion).
Does this effect i386 which also uses fsincos?
I'd guess so - but that would also be a separate bug, which could be fixed
separately as long as it's entered in Bugzilla.
However, the patch should have a testcase added to the testsuite (that
fails with a huge number of ULPs before the patch, passes with at most a
few ULPs after it). There don't appear to be any tests at all for large
arguments to sin, cos, sincos or tan at present. And if such a test then
fails for i386, or for x86_64 long double, either it will be necessary to
add entries with huge numbers of ULPs to libm-test-ulps files (at present
763 is the largest number in any file, and only i386 and x86_64 have any
numbers 26 or more), or it will be necessary to fix more cases as part of
the patch.