From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11311 invoked by alias); 3 Feb 2012 14:42:42 -0000 Received: (qmail 11299 invoked by uid 22791); 3 Feb 2012 14:42:41 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Feb 2012 14:42:27 +0000 From: "vincent-srcware at vinc17 dot net" To: glibc-bugs@sources.redhat.com Subject: [Bug math/13658] New: sincos() is inaccurate for large inputs on x86_64 Date: Fri, 03 Feb 2012 14:42: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-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vincent-srcware at vinc17 dot net X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: aj at suse dot de X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-02/txt/msg00007.txt.bz2 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 #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. -- 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.