This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix for bz#13658 - using fsincos on x86-64
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Carlos O'Donell <carlos at systemhalted dot org>
- Cc: Andreas Jaeger <aj at suse dot com>, libc-alpha <libc-alpha at sourceware dot org>, jakub at redhat dot com, Andreas Schwab <schwab at redhat dot com>
- Date: Thu, 23 Feb 2012 21:29:40 +0000 (UTC)
- Subject: Re: Fix for bz#13658 - using fsincos on x86-64
- References: <4F343F56.3040402@suse.com> <CADZpyiz8S9cf25sB4_AzquV=UDgs4Dk-2u8N5w=i_V+Usd8nqg@mail.gmail.com>
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.
> Does this also effect m68k which uses fsincos (M68000PM/AD REV.1
> states loss of accuracy if the input is > 10^20).
If you're concerned about that I'd suggest filing a ports bug for the m68k
maintainer to look at.
--
Joseph S. Myers
joseph@codesourcery.com