Are you sure C "deals"?
$ cat imprec.c #include <stdio.h> int main () { float fa = 36.8; float fb = 36.6; double da = 36.8; double db = 36.6; printf( ( fa >= ( fb + 0.2 ) ) ? "true\n" : "false\n" ); printf( ( da >= ( db + 0.2 ) ) ? "true\n" : "false\n" ); } $ gcc -o imprec imprec.c $ ./imprec true false
You're seeing the result of cut-off caused by float's lower precision.
Perl and Python use doubles in all floating point operations.
Makeshifts last the longest.
In reply to Re^3: float values and operators
by Aristotle
in thread float values and operators
by soulchild
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |