gcc bug v. 2.95.2
Nikos Mamoulis
mamoulis@dblab.ece.ntua.gr
Tue May 16 09:48:00 GMT 2000
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
More information about the Gcc-bugs
mailing list