Check for equality and inequality operations on floating-point values
Check ID:
mathworks.misra.CompareFloatEquality
Identify equality and inequality operations on floating-point values.
Description
The check flags sources causing equality or inequality operations on floating-point values.
Following the recommendations of this check increases the likelihood of generating MISRA C:2012 compliant code for embedded applications, as well as code that complies with the CERT C and CWE standards.
The check does not flag blocks with equality or inequality operations on floating-point values if they are justified with a Polyspace® annotation. When you run the check, the Blocks with justification table lists blocks with equality or inequality operations that have a justification.
Available with Embedded Coder® and Simulink® Check™.
Note
Stateflow® license is needed if the model contains Stateflow elements.
Results and Recommended Actions
Condition | Recommended Action |
---|---|
Model object has an equality or inequality operation on a floating-point value. | Consider using non-floating-point values for equality or inequality operations. |
Capabilities and Limitations
You can:
Exclude blocks and charts from this check if you have a Simulink Check license.
See Also
MISRA C:2012, Dir 1.1
CERT C, FLP02-C
CWE, CWE-1077
Annotate Code and Hide Known or Acceptable Results (Polyspace Bug Finder)
MISRA C (Embedded Coder)