Bug 13851

Summary: sincosl(), sinl() and cosl(), tanl() are incorrect for large inputs on x86_64 and x86
Product: glibc Reporter: Andreas Jaeger <aj>
Component: mathAssignee: Not yet assigned to anyone <unassigned>
Severity: normal CC: aj, bugdal, carlos, ppluzhnikov, vincent-srcware
Priority: P2 Keywords: glibc_2.15
Version: 2.15Flags: fweimer: security-
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on: 13658, 15563    
Bug Blocks:    

Description Andreas Jaeger 2012-03-15 13:41:19 UTC
+++ This bug was initially created as a clone of Bug #13658 +++

sincosl() 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 long double x = 1.0e22;
  long double s1, s2, c1;

  sincosl (x, &s1, &c1);
  s2 = sinl (x);
  printf ("s1 = %.17Lg\n", s1);
  printf ("s2 = %.17Lg\n", s2);
  return 0;

s1 = -0.63300455357085282
s2 = -0.63300455357085282

Correct output would be:
Comment 1 Andreas Jaeger 2012-03-15 14:59:14 UTC
This applies to sinl, cosl, tanl and sincosl.
Comment 2 Joseph Myers 2012-03-16 12:37:15 UTC
sinl, cosl, sincosl fixed by:

commit 8848d99dce1e57168a492d146f5e72195c7665a5
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Fri Mar 16 12:28:25 2012 +0000

    Implement ldbl-96 sinl / cosl / sincosl (bug 13851).

tanl will need a separate fix.
Comment 3 Joseph Myers 2012-03-16 20:10:30 UTC
tanl fixed by:

commit 11b90b9f504df5b2da91ce3a06c1657d99e4a95f
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Fri Mar 16 20:05:04 2012 +0000

    Fix tan, tanl for large inputs.