This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/13658] New: sincos() is inaccurate for large inputs on x86_64
- From: "vincent-srcware at vinc17 dot net" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Fri, 03 Feb 2012 14:41:59 +0000
- Subject: [Bug math/13658] New: sincos() is inaccurate for large inputs on x86_64
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=13658
Bug #: 13658
Summary: sincos() is inaccurate for large inputs on x86_64
Product: glibc
Version: 2.13
Status: NEW
Severity: normal
Priority: P2
Component: math
AssignedTo: aj@suse.de
ReportedBy: vincent-srcware@vinc17.net
Classification: Unclassified
sincos() 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 double x = 1.0e22;
double s1, s2, c1;
sincos (x, &s1, &c1);
s2 = sin (x);
printf ("s1 = %.17g\n", s1);
printf ("s2 = %.17g\n", s2);
return 0;
}
outputs:
s1 = 0.46261304076460175
s2 = -0.85220084976718879
(s2 is the correct value). I suppose that contrary to the other trig functions,
glibc uses the hardware sincos instruction, which has never been meant to be
used directly by a C library (the hardware elementary functions of the x86
processors were designed for small inputs, and they must not be used by code
where inputs can be large, like here). The sincos() function can simply be
implemented by a call to sin() and a call to cos() on this target.
Ditto for sincosf() and sincosl().
Note: x86 (32 bits) has the same problem, but it has been claimed that users
don't care about correctness on this target.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.