This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/11914] New: comparing doubles
- From: "birger dot b at gmx dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Aug 2003 05:23:19 -0000
- Subject: [Bug c/11914] New: comparing doubles
- 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=11914
Summary: comparing doubles
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: birger dot b at gmx dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
Overview Description: More detailed expansion of summary.
Drag-selecting any page crashes Mac builds in NSGetFactory
Steps to Reproduce:
Compile and run
Actual Results:
Program's output:
shouldn't be here
ok!
ok!
Expected Results:
ok!
ok!
ok!
Build Date & Platform:
[lee@yavin strange]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Additional Builds and Platforms:
On sparc-sun-solaris2.6 the output is also not as expected but not
the same as on Linux:
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
gcc version 2.95.2 19991024 (release)
Program's output:
ok!
shouldn't be here
ok!
The following is the *.i file:
# 1 "exp.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "exp.c"
int printf(const char *format, ...);
double two = 2;
double five = 5;
const double f() {
return five;
}
int main () {
# 21 "exp.c"
if(two/f() == two/f()) {
printf("ok!\n");
}
else {
printf("shouldn't be here\n");
}
if((long double)two/f() == two/f()){
printf("ok!\n");
}
else {
printf("shouldn't be here\n");
}
if(two/five == two/five){
printf("ok!\n");
}
else {
printf("shouldn't be here\n");
}
return 0;
}