in reply to Re: float values and operators
in thread float values and operators
... and does happen in Python ...bash-2.05b$ cat float.c #include <stdio.h> int main () { float a = 36.8; float b = 36.6; if( a >= ( b + 0.2 ) ) { printf ("true\n"); } } bash-2.05b$ gcc -o float float.c bash-2.05b$ ./float true
I would of included a java example but I aint got all day to download the SDK. Maybe I'll update with one later. Can you explain why C deals with float point number while Perl and Python appear to have this problem? Is it a compiled verses and interpreted language issue?bash-2.05b$ cat float.py #!/usr/bin/python A = 36.8 B = 36.6 if( A >= B + 0.2 ): print "true" else: print "false" bash-2.05b$ ./float.py false
| Plankton: 1% Evil, 99% Hot Gas. |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: float values and operators
by Aristotle (Chancellor) on Aug 11, 2004 at 21:43 UTC | |
|
Re^3: float values and operators
by ikegami (Patriarch) on Aug 11, 2004 at 21:49 UTC |