From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15109 invoked by alias); 3 Jun 2013 16:05:48 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 14899 invoked by uid 48); 3 Jun 2013 16:05:45 -0000 From: "carlos at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug math/15563] New: sincos() is incorrect for long double and large inputs on x86_64 Date: Mon, 03 Jun 2013 16:05:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: math X-Bugzilla-Version: 2.18 X-Bugzilla-Keywords: glibc_2.15 X-Bugzilla-Severity: normal X-Bugzilla-Who: carlos at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc dependson blocked Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-06/txt/msg00006.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=15563 Bug ID: 15563 Summary: sincos() is incorrect for long double and large inputs on x86_64 Product: glibc Version: 2.18 Status: NEW Keywords: glibc_2.15 Severity: normal Priority: P2 Component: math Assignee: unassigned at sourceware dot org Reporter: carlos at redhat dot com CC: aj at suse dot de, bugdal at aerifal dot cx, carlos at redhat dot com, ppluzhnikov at google dot com, vincent-srcware at vinc17 dot net Depends on: 13658 Blocks: 13851, 13852, 13854 Still broken for long double on x86/x86_64. Tested with current sources. +++ This bug was initially created as a clone of Bug #13658 +++ sincos() is inaccurate for large inputs on x86_64: with glibc 2.13, #define _GNU_SOURCE #include #include 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. -- You are receiving this mail because: You are on the CC list for the bug.