Errors during floating point operations are often neglected by applications; instead, the greatest effort is usually in validating the operands before an operation. Errors occurring during floating point operations are admittedly difficult to determine and diagnose, but the benefits of understanding how to check for these errors and employing the process of doing so may outweigh the costs. This recommendation suggests ways to capture errors during floating point operations.
...
Though the code above also results in undefined behavior, most implementations do not view floating point division by zero as a terminal error. If extra steps are not taken, the operation happens "silently."
...
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="53add39ac13b6751-e7ff6a9c-46764d40-bd67b86b-5e96c9bad9bca4255358bb3e"><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> |
...
However, as the comments indicate, various exceptional conditions occur , that may lead to unexpected arithmetic results.
...