Possible duplicate:Why decimal numbers cannot be represented exactly in binary format?The program is not included in the if statement
So, I'm trying to run a program with two variables, when one variable is equal to the other, it performs a function. In this case, print spam. However, for some reason, when I run this program, I do not get any result, although I know that they are equal.
g=0.0 b=3.0 while g < 30.0: if g==b: print "Hi" g+=.1 print g, b
, .1 0.0 3.0. , . , 3,0. == .
==
(, 0 300 1) float (, set f = *.1), , , , , , .
, ( , ). , , . ( 32- -2 24 +2 24. . .1, 1,1. .5,.25,.375 , .)
, , , , - ( epsilon), . , epsilon 1.0 * 10 ^ -6, . (, , , ).
, , , g b , epsilon different - , , , epsilon.
abs(g - b) < epsilon
, .