Invalid operation on floats
Result of floating-point operation is NaN for non-NaN operands
Description
This check determines if the result of a floating-point operation is NaN. The check is performed only if you enable a verification mode that incorporates NaNs and specify that the verification must highlight operations that result in NaN.
If you specify that the verification must produce a warning for NaN, the check is:
Red, if the operation produces NaN on all execution paths that the software considers, and the operands are not NaN.
Orange, if the operation produces NaN on some of the execution paths when the operands are not NaN.
Green, if the operation does not produce NaN unless the operands are NaN.
If you specify that the verification must forbid NaN, the check color depends on the result of the operation only. The color does not depend on the operands.
The check also highlights conversions from floating-point variables to integers where the floating-point variable can be NaN. In this case, the check is always performed when you incorporate NaNs in the verification and does not allow NaNs as input to the conversion.
To enable this verification mode, use these options:
NaNs (-check-nan)
: Use argumentwarn-first
orforbid
.
Examples
Result Information
Group: Numerical |
Language: C | C++ |
Acronym: INVALID_FLOAT_OP |
Version History
Introduced in R2016a