jc_0481: Use of hard equality comparisons for floating point numbers in Stateflow
Since R2020a
Guideline Publication
Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®
Sub ID Recommendations
NA-MAAB — a
JMAAB — a
MATLAB Versions
All
Rule
Sub ID a
These equality comparison operators shall not be used in floating-point operands:
==
!=
~=
<>
Not Applicable
Equality comparison operators are not used in floating-point operands.
Equality comparison operator ==
is used in
floating-point operands.
Rationale
Sub ID a:
Due to the nature of the floating-point data type, as it contains an error, the result of the equivalence comparison operation may be false when it was expected to be true.
Verification
Model Advisor check: Check usage of floating-point expressions in Stateflow charts (Simulink Check)
Last Changed
R2024b
See Also
Version History
Introduced in R2020a