fun fact: in python 0.1 + 0.1 + 0.1 isn't equal to 0.3,(reply>), This has to do with floating point rounding error, which applies similarly to most languages. Floating point comparisons are best done with something along the lines of "first - second &lt; epsilon" where epsilon is the smallest gap between numbers that is important to maintain. (Another trick is to use math that doesn't accumulate rounding errors over time, if possible.)