This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix for bz#13658 - using fsincos on x86-64


On 02/23/2012 10:29 PM, Joseph S. Myers wrote:
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).

Sorry, I won't have time in the near future to do this myself.


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.

I can add a couple of testcases. How do we want to continue? Should we use the patch to fix the double case - and then later handle long double, or do you want everything fixed at the same time?


Andreas
--
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]