You can't compare floats/doubles directly. Like Salem already said they are inaccurate by definition. Instead do a comparison via an epsilon value. I.e. If the difference between the lhs and rhs is less than some value (0.0001 for example - dependson your accuracy needs) then the values are considered equal.