-detect-bad-float-op-on-zero
Detect floating point comparison with equality operator when one of the operand is
0.0
Syntax
-detect-bad-float-op-on-zero
Description
-detect-bad-float-op-on-zero modifies the behavior of Polyspace®
Bug Finder™ checkers so that equality comparison using an equality
(==) or inequality (!=) operator is reported even
when one of the operand is 0.0.
Examples
Consider this code:
extern float foo(void);
float x;
x = foo();
if (x==0.0f) {
//...
}(x==0.0f). If you specify this option, then these violations and
defects are reported for the comparison operation:
If you are running an analysis using the user
interface, you can enter this option in the Other field, under the
Advanced Settings node on the Configuration
pane. See Other. To
specify this option at the command line, append the option to your usual Bug Finder
command:
polyspace-bug-finder -sources filename ^ -checkers BAD_FLOAT_OP -detect-bad-float-op-on-zero