Bug 16705 - wrong computation of cos/sin for large angle
Summary: wrong computation of cos/sin for large angle
Status: RESOLVED DUPLICATE of bug 16623
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: 2.19
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-14 12:31 UTC by alduc1
Modified: 2014-06-13 06:33 UTC (History)
0 users

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


Attachments
This C code tests cosine and sine values for large angles. (1.45 KB, text/x-csrc)
2014-03-14 12:31 UTC, alduc1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description alduc1 2014-03-14 12:31:43 UTC
Created attachment 7471 [details]
This C code tests cosine and sine values for large angles.

I use the eglibc 2.19 installed on ubuntu Trusty 14.04.
 
With this version of eglibc, the library libm computes wrong cosine and sine for large enough angles (error on sign).

For example, sin(2*pi*0.27*7390843) and sin(2*pi*2.27*7390843) should give the same result but :

  sin(2*pi*0.27*7390843)         =  -0.63742399  OK
  sin(2*pi*2.27*7390843)         =   0.63742398  KO

The result should be the same because :
  (2*pi*2.27*7390843) % 2*pi = 2*pi*0.27*7390843.

Another example :

  cos(2*pi*0.27*7390879)         =  -0.48175367  OK
  cos(2*pi*2.27*7390879)         =   0.48175367  KO

This bug does not occur with 2.18 or previous version of eglibc.

I reproduce the bug with the last compiled git version then it is not a problem from ubuntu. With the 2.18 git version, there is no bug.

Ubuntu package details:

  Package: libc6
  Status: install ok installed
  Priority: required
  Section: libs
  Installed-Size: 10495
  Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
  Architecture: amd64
  Multi-Arch: same
  Source: eglibc
  Version: 2.19-0ubuntu2
  Replaces: libc6-amd64
  Provides: glibc-2.19-1
  Depends: libgcc1
  Suggests: glibc-doc, debconf | debconf-2.0, locales
  Breaks: hurd (<< 1:0.5.git20140203-1), lsb-core (<= 3.2-27), nscd (<< 2.19)
  Conflicts: prelink (<= 0.0.20090311-1), tzdata (<< 2007k-1), tzdata-etch
  Conffiles:
   /etc/ld.so.conf.d/x86_64-linux-gnu.conf 593ad12389ab2b6f952e7ede67b8fbbf
  Description: Embedded GNU C Library: Shared libraries
   Contains the standard libraries that are used by nearly all programs on
   the system. This package includes shared versions of the standard C library
   and the standard math library, as well as many others.
  Homepage: http://www.eglibc.org
  Original-Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>

Ubuntu details:

  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=14.04
  DISTRIB_CODENAME=trusty
  DISTRIB_DESCRIPTION="Ubuntu Trusty Tahr (development branch)"

My ubuntu is up to date.
Comment 1 Andreas Schwab 2014-03-14 12:40:16 UTC
Already fixed.

*** This bug has been marked as a duplicate of bug 16623 ***