simple float numbers problem

Batista, Facundo FBatista at
Fri Nov 7 17:46:25 CET 2003

Vio wrote:

#- I need to test for equality between simple 2 decimal 
#- numbers. For example:
#- if (10 + 15.99) == 25.99:
#-        do some stuff...

So, don't use floating point, as the implementation of floating point (not
by Python, just C and the coprocesor of your chip) is in binary.


#- Perhaps because Python translates "25.99" to 
#- "25.98999999999999998" and 
#- not "25.99", which may be the reason for this error (me 
#- guessing...). If 
#- that's the case, how do I force Python to only use 2 decimal 
#- points, and 

You must work with integers or wait me to finish, :\

.	Facundo

More information about the Python-list mailing list