Subnormal float
Floating-point operation has subnormal results
Description
This check determines if a floating-point operation produces a subnormal result.
Subnormal numbers have magnitudes less than the smallest floating-point number that can be represented without leading zeros in the significand. The presence of subnormal numbers indicates loss of significant digits. This loss can accumulate over subsequent operations and eventually result in unexpected values. Subnormal numbers can also slow down the execution on targets without hardware support.
By default, the results of the check do not appear in your verification results. To see the
results of the check, change the default value of the option Subnormal detection mode (-check-subnormal)
. The results of the check vary based on the detection
mode that you specify. In all modes other than
allow
, to identify the subnormal results, look for red or
orange Subnormal float checks on operations.
Mode | Check Colors | Behavior Following Check |
---|---|---|
This mode detects the occurrence of a subnormal value. This mode stops the execution path with the subnormal result and prevents subnormal values from propagating further. Therefore, in practice, you see only the first occurrence of the subnormal value. | The color of the check depends only on the result of the operation. The check flags an operation that has subnormal results even if those results come only from subnormal operands. For
instance, if | Blocking check. If the check is red, the verification stops. If the check is orange, the verification removes the execution paths containing the subnormal result from consideration. For instance, the tooltip on the result does not show the subnormal values. |
This mode highlights all occurrences of subnormal values. Even if a subnormal result comes from previous subnormal values, the result is highlighted. | The color of the check depends only on the result of the operation. The check flags an operation that has subnormal results even if those results come only from subnormal operands. For
instance, if | Non-blocking check. The verification continues even if the check is red. If the check is orange, the verification does not remove the execution paths containing the subnormal result from consideration. |
This mode highlights the first occurrence of a subnormal value. If a subnormal value propagates to further subnormal results, those subsequent results are not highlighted. | The check color depends on the result of the operation and the operand values. The check does not flag a subnormal result if it comes only from subnormal operands. In this mode, the check is:
| Non-blocking check. The verification continues even if the check is red. If the check is orange, the verification does not remove the execution paths containing the subnormal result from consideration. |
If you choose to check for subnormals, you can also identify
from the tooltips whether a variable range excludes subnormal values.
For instance, if the tooltips show [-1.0
.. -1.1754E-38] or [-0.0..0.0] or [1.1754E-38..1.0]
, you
can interpret that the variable does not have subnormal values.
Examples
Result Information
Group: Numerical |
Language: C | C++ |
Acronym: SUBNORMAL |
Version History
Introduced in R2016b