...
The minimum and maximum float values are converted to minimum and maximum int values (0x80000000 and 0x7fffffff respectively). The resulting short values are the lower 16 bits of these values (0x0000 and 0xffff). The resulting final values (0 and -1) could might be unexpected.
Compliant Solution (Floating-Point to Integer Conversion)
...
INT31-C. Ensure that integer conversions do not result in lost or misinterpreted data | ||||
| FLP34-C. Ensure that floating point conversions are within range of the new type | |||
INT31-CPP. Ensure that integer conversions do not result in lost or misinterpreted data | ||||
| FLP34-CPP. Ensure that floating point conversions are within range of the new type | |||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8d49ede069f31f82-de1a677e-4f26466b-899890a9-889cab7f6b1d85f61c173fdc"><ac:plain-text-body><![CDATA[ | [ISO/IEC TR 24772:2010 | http://www.aitcnet.org/isai/] | Numeric Conversion Errors [FLC] | ]]></ac:plain-text-body></ac:structured-macro> |
CWE-681. Incorrect conversion between numeric types | ||||
| CWE-197. Numeric truncation error |
...