jc_0800: Comparing floating-point types in Simulink
Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®
Sub ID Recommendations
NA-MAAB — a
JMAAB — a
Sub ID a
Equivalence comparison operators (
shall not be used on floating-point data types.
Uses equivalence comparison operators
~= on the floating-point data type.
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.
Model Advisor check: Check comparison of floating point types in Simulink (Simulink Check)
Introduced in R2020a