Bug 13851 - sincosl(), sinl() and cosl(), tanl() are incorrect for large inputs on x86_64 and x86
Summary: sincosl(), sinl() and cosl(), tanl() are incorrect for large inputs on x86_64...
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.15
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: glibc_2.15
Depends on: 13658 15563
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-15 13:41 UTC by Andreas Jaeger
Modified: 2014-06-26 13:58 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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;
}

outputs:
s1 = -0.63300455357085282
s2 = -0.63300455357085282

Correct output would be:
0.85220084976718879
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.