This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/16705] New: wrong computation of cos/sin for large angle


https://sourceware.org/bugzilla/show_bug.cgi?id=16705

            Bug ID: 16705
           Summary: wrong computation of cos/sin for large angle
           Product: glibc
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: alduc1 at free dot fr

Created attachment 7471
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7471&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]