public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/1163] New: sinf inaccurate for some inputs
@ 2005-08-03 23:32 bob dot wilson at acm dot org
  2005-10-15 23:47 ` [Bug math/1163] " drepper at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: bob dot wilson at acm dot org @ 2005-08-03 23:32 UTC (permalink / raw)
  To: glibc-bugs

The version of sinf() in sysdeps/ieee754/flt-32/ gives results that are wrong by more than 1 
ulp for at least some inputs.  The testcase below will demonstrate the problem for sinf(8.203124e-01).  
The output from this test on an x86_64 platform running RH Enterprise 3 is:

inputs: a = 8.203124e-01
actual    =     7.3135888576508e-01     (0x3f3b3a56)
expected  =     7.3135894536972e-01     (0x3f3b3a57)
sin(a)    =     7.3135894750029e-01

The sinf() result is 1 ulp smaller than the expected value, which is already slightly smaller than the real 
answer.  Other math libraries derived from fdlibm (e.g., newlib) have the same problem.  The test 
program is:

#include <stdio.h>
#include <math.h>

unsigned int ta = 0x3f51ffff;

main ()
{
  float a = *(float *)&ta;
  float c = sinf(a);
  float d = sin(a);
  printf("inputs: a = %e\n", a);
  printf("actual    =\t%.13e\t(0x%08x)\n", c, *(unsigned *)&c);
  printf("expected  =\t%.13e\t(0x%08x)\n", d, *(unsigned *)&d);
  printf("sin(a)    =\t%.13e\n", sin(a));
}

-- 
           Summary: sinf inaccurate for some inputs
           Product: glibc
           Version: 2.3.2
            Status: NEW
          Severity: minor
          Priority: P3
         Component: math
        AssignedTo: aj at suse dot de
        ReportedBy: bob dot wilson at acm dot org
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: x86_64-redhat-linux


http://sources.redhat.com/bugzilla/show_bug.cgi?id=1163

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-10-24 12:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-1163-131@http.sourceware.org/bugzilla/>
2012-02-22 21:53 ` [Bug math/1163] sinf inaccurate for some inputs jsm28 at gcc dot gnu.org
2012-06-22 18:08 ` liubov.dmitrieva at gmail dot com
2012-06-22 18:59 ` joseph at codesourcery dot com
2012-06-22 19:54 ` joseph at codesourcery dot com
2012-06-22 20:45 ` joseph at codesourcery dot com
2012-10-24 12:44 ` jsm28 at gcc dot gnu.org
2005-08-03 23:32 [Bug math/1163] New: " bob dot wilson at acm dot org
2005-10-15 23:47 ` [Bug math/1163] " drepper at redhat dot com
2005-12-30  9:33 ` aj at suse dot de
2008-03-29  4:28 ` jvdelisle at gcc dot gnu dot org
2008-03-29  4:31 ` jvdelisle at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).