Never compare floats directly.  Subtract them, and ensure their values are close enough to some epsilon (small value like 0.001).

Also, you might want to make these magic values constants.