jc_0800: Comparing floating-point types in Simulink
Sub ID Recommendations
NA-MAAB — a
JMAAB — a
MATLAB Versions
All
Rule
Sub ID a
Equivalence comparison operators (==
, ~=
)
shall not be used on floating-point data types.
Not Applicable
Uses equivalence comparison operators ==
and
~=
on the floating-point data type.
Rationale
Sub ID a:
Due to the characteristics of the floating-point, since the error is included in the value, the result of the equivalence comparison operation may be false when it was expected to be true.
Verification
Model Advisor check: Comparing floating point types in Simulink (Simulink Check)
Last Changed
R2020a
See Also
JMAAB guideline jc_0800, which is available in Control Algorithm Modeling Guidelines Using MATLAB, Simulink, and Stateflow on the MathWorks® website.
Version History
Introduced in R2020a