...
Operating System | How to handle floating point errors | |||
---|---|---|---|---|
Linux | Use the C99 floating point exception functions. | |||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7d61191355defc50-7b312096-41794390-8408b96c-fe1de2718d31cb58eef346e7"><ac:plain-text-body><![CDATA[ | Windows | Either use the C99 floating point exception function or structured exception handling through | AA. C References#MSDN]] | ]]></ac:plain-text-body></ac:structured-macro> |
...
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
FLP03-C | low | probable | high | P2 | L3 |
Automated Detection
The tool Compass/ROSE could detect violations of this rule, by ensuring that floating point operations are surrounded by feclearexcept()
and fetestexcept()
. It would need to look for type conversions to float or double, divisions (by a number not known to be nonzero) and multiplication. It may be wisest to apply this to all floating point operations in general.
...