public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/55560] New: fesetround(FE_DOWNWARD) causes cos() to return values outside the range of -1 to +1
@ 2012-12-02 7:37 pj at ecstaticlyrics dot com
2012-12-02 7:40 ` [Bug other/55560] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: pj at ecstaticlyrics dot com @ 2012-12-02 7:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55560
Bug #: 55560
Summary: fesetround(FE_DOWNWARD) causes cos() to return values
outside the range of -1 to +1
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: other
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pj@ecstaticlyrics.com
Created attachment 28852
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28852
Contents of /proc/cpuinfo
Simple test program:
#include <stdio.h>
#include <math.h>
#include <fenv.h>
void main() {
double a, c;
fesetround(FE_DOWNWARD);
for (a = -M_PI; a <= +M_PI; a += 0.000001) {
c = cos(a);
if (c < -1.0 || c > +1.0) {
printf("cos(%f) is not %f\n", a, c);
};
};
};
Compile like so: gcc -o test test.c -lm
Expected output is nothing at all, since cos() always returns values between
-1.0 and +1.0. The actual output, however, is 20,009 lines. Here are the
first ten:
cos(-3.141593) is not -1.000485
cos(2.430171) is not 3614403565883090812337301068370710204239577088.000000
cos(2.430172) is not 195176399637579483727029815821181674649563430912.000000
cos(2.430173) is not 386738395709080693943503989636585388708949131264.000000
cos(2.430174) is not 578300391780195078044017318793663580791807934464.000000
cos(2.430175) is not 769862387850731413470826575343659276213015281664.000000
cos(2.430176) is not 961424383920497666369804385270998542397395173376.000000
cos(2.430177) is not 1152986379989302370794292276806879317292807618560.000000
cos(2.430178) is not 1344548376056954223056908607395862930425122914304.000000
cos(2.430179) is not 1536110372123261919470271734482510711320211357696.000000
The problem disappears if the test program is compiled with "-m32" or if
"fesetround(FE_DOWNWARD)" is removed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/55560] fesetround(FE_DOWNWARD) causes cos() to return values outside the range of -1 to +1
2012-12-02 7:37 [Bug other/55560] New: fesetround(FE_DOWNWARD) causes cos() to return values outside the range of -1 to +1 pj at ecstaticlyrics dot com
@ 2012-12-02 7:40 ` pinskia at gcc dot gnu.org
2012-12-02 9:10 ` pj at ecstaticlyrics dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-12-02 7:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55560
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|major |normal
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-12-02 07:40:16 UTC ---
I think this is a bug in the glibc version you are using rather than GCC. Have
you tried a newer version of glibc like say 2.16?
Oh what version of glibc are you using? find out by invoking /lib/libc.so.6 .
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/55560] fesetround(FE_DOWNWARD) causes cos() to return values outside the range of -1 to +1
2012-12-02 7:37 [Bug other/55560] New: fesetround(FE_DOWNWARD) causes cos() to return values outside the range of -1 to +1 pj at ecstaticlyrics dot com
2012-12-02 7:40 ` [Bug other/55560] " pinskia at gcc dot gnu.org
@ 2012-12-02 9:10 ` pj at ecstaticlyrics dot com
2012-12-02 20:39 ` joseph at codesourcery dot com
2012-12-09 0:40 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pj at ecstaticlyrics dot com @ 2012-12-02 9:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55560
--- Comment #2 from pj at ecstaticlyrics dot com 2012-12-02 09:10:35 UTC ---
GNU C Library (Ubuntu EGLIBC 2.15-0ubuntu20) stable release version 2.15
I downloaded glibc 2.16, but it encounters an error while compiling.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/55560] fesetround(FE_DOWNWARD) causes cos() to return values outside the range of -1 to +1
2012-12-02 7:37 [Bug other/55560] New: fesetround(FE_DOWNWARD) causes cos() to return values outside the range of -1 to +1 pj at ecstaticlyrics dot com
2012-12-02 7:40 ` [Bug other/55560] " pinskia at gcc dot gnu.org
2012-12-02 9:10 ` pj at ecstaticlyrics dot com
@ 2012-12-02 20:39 ` joseph at codesourcery dot com
2012-12-09 0:40 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: joseph at codesourcery dot com @ 2012-12-02 20:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55560
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2012-12-02 20:39:23 UTC ---
This would have been glibc bug 3976 which was fixed for cos by:
commit 804360ed837e3347c9cd9738f25345d2587a1242
Author: Joseph Myers <joseph@codesourcery.com>
Date: Fri Mar 2 20:51:39 2012 +0000
Fix sin, cos, tan in non-default rounding modes (bug 3976).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug other/55560] fesetround(FE_DOWNWARD) causes cos() to return values outside the range of -1 to +1
2012-12-02 7:37 [Bug other/55560] New: fesetround(FE_DOWNWARD) causes cos() to return values outside the range of -1 to +1 pj at ecstaticlyrics dot com
` (2 preceding siblings ...)
2012-12-02 20:39 ` joseph at codesourcery dot com
@ 2012-12-09 0:40 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-12-09 0:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55560
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |MOVED
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-12-09 00:40:04 UTC ---
So closing as moved (as in moved to glibc bug).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-12-09 0:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-02 7:37 [Bug other/55560] New: fesetround(FE_DOWNWARD) causes cos() to return values outside the range of -1 to +1 pj at ecstaticlyrics dot com
2012-12-02 7:40 ` [Bug other/55560] " pinskia at gcc dot gnu.org
2012-12-02 9:10 ` pj at ecstaticlyrics dot com
2012-12-02 20:39 ` joseph at codesourcery dot com
2012-12-09 0:40 ` pinskia at gcc dot gnu.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).