The General rule is not to compare floats for equality, (is 0.0==-0.0, etc.). Use a epsilon based comparision scheme instead or a wrapper around it.

That's not exactly true. You cannot (and should not) compare floating points for equality, and use epsilon-based comparison instead, only in one certain case: when one of the arguments if the result of computation, during which a computational error might accumulate.

If you have two exact or constant values, comparing them directly is perfectly fine. :-) Nowadays floating-point hardware support is not that "buggy".

Reply via email to