This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc bug v. 2.95.2


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]