This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/1163] New: sinf inaccurate for some inputs
- From: "bob dot wilson at acm dot org" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 3 Aug 2005 23:32:39 -0000
- Subject: [Bug math/1163] New: sinf inaccurate for some inputs
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
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.