This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/16708] New: sin () gets wrong answer on Sempron 145
- From: "warshall at 99main dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 14 Mar 2014 15:31:00 +0000
- Subject: [Bug math/16708] New: sin () gets wrong answer on Sempron 145
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=16708
Bug ID: 16708
Summary: sin () gets wrong answer on Sempron 145
Product: glibc
Version: 2.19
Status: NEW
Severity: normal
Priority: P2
Component: math
Assignee: unassigned at sourceware dot org
Reporter: warshall at 99main dot com
The sin() call gives wrong results for some (fortunately rare) input values.
To replicate:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char **argv) {
double x = atof (argv[1]);
printf ("x = %.30g aka %a\n", x, x);
printf ("sin (x) = %g\n", sin (x));
printf ("sin (x-2pi) = %g\n", sin (x-2*M_PI));
return 0;
}
Compile with:
gcc -Wall -O2 -march=amdfam10 <name of file> -lm
./a.out 24985672148.49707
Output is:
x = 24985672148.4970703125 aka 0x1.7450c6751fdp+34
sin (x) = 0.552665
sin (x-2pi) = -0.552664
which is obviously wrong, since the two answers should be the same (mod
roundoff error from the finite precision of computing x-2*M_PI)
I don't think this is a duplicate of
https://sourceware.org/bugzilla/show_bug.cgi?id=16625, since
./a.out 12.3
behaves sensibly on my system. However, my glibc was compiled with gcc 4.8.2.
This bug gives rise to https://bugzilla.gnome.org/show_bug.cgi?id=726250 on
gnumeric.
-Andrew Warshall
--
You are receiving this mail because:
You are on the CC list for the bug.