This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc bug v. 2.95.2
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc bug v. 2.95.2
- From: Nikos Mamoulis <mamoulis at dblab dot ece dot ntua dot gr>
- Date: Tue, 16 May 2000 19:48:11 +0300 (EET DST)
Hi,
I just found the following bug:
Expressions a>b+c, a==b+c, if a,b,c are floats are not evaluated
correctly.
If a=b+c the compiler considers a>b+c
Run the following program:
#include <stdio.h>
main()
{
float i = 0.106400;
float j = 0.102400;
float k = j+0.004;
printf("%d\n", i == j+ 0.004);
printf("%d\n", i > j+ 0.004);
printf("%d\n", i < j+ 0.004);
printf("----\n");
printf("%d\n", i == k);
printf("%d\n", i > k);
printf("%d\n", i < k);
}
Output:
0
1
0
----
1
0
0
PS. There is no problem with doubles
Regards,
Nikos