\[~ann.campbell.2] For rules coming from MISRA I prefer titles from MISRA instead of hand-crafted ones ;) Same probably for description - I expect it to be good in MISRA.
@Ann, for me the compliant solution is incorrect because if the developer really wants to check for equality, using the ">=" operator is obviously not an option.
See MISRA description:
____
The recommended method for achieving deterministic floating-point comparisons is to write a library
that implements the comparison operations. The library should take into account the floating-point
granularity (FLT_EPSILON) and the magnitude of the numbers being compared. See also Rule 13.4 and
For me this is crappy code no matter if you are using floating point or not. I truly believe this case should not pollute this rule and be a rule on its own (applied to every numeric type) with the suggestion to refactor it using ``++=++`` or ``++!=++``
\[~nicolas.peru] what if the user activates this rule but not the other one?
Also, the "crappy" example is drawn almost exactly from MISRA. We can debate whether or not it belongs in the Java implementation (although it is an equality test), but it needs to remain in the main rule.