This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/12129] New: Unexpected loss of floating point precision in assignment
- From: "preciseflight at yahoo dot com dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Sep 2003 05:04:40 -0000
- Subject: [Bug target/12129] New: Unexpected loss of floating point precision in assignment
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12129
Summary: Unexpected loss of floating point precision in
assignment
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: preciseflight at yahoo dot com dot au
CC: gcc-bugs at gcc dot gnu dot org
#include <stdio.h>
#define OP(x) ((x) * .29425635593220338949)
int main (void) {
double a = 5671.92506245995003720887;
double b = OP (a);
printf ("%d %d\n", (int) OP (a), (int) b);
return 0;
}
On an i386 (gcc 2.95.4, 3.3), the output is:
1668 1669
Clearly, looking at the code, these 2 numbers should be equal!
However, on a sparc (gcc 2.95.3), the output is correct:
1669 1669