Keil Logo

float Errors

The CARM Compiler detects floating-point errors and reports them by setting the float value to one of several special binary values. Your software must appropriately respond to floating-point error conditions.

The floating-point error values are defined as a part of the IEEE standard and are used whenever an error occurs during normal processing of floating-point operations. Your code should check for possible arithmetic errors at the end of each floating-point operation.

Name Value Meaning
NaN 0xFFFFFFF Not a Number
+INF 0x7F80000 Positive Infinity (positive overflow)
-INF 0xFF80000 Negative Infinity (negative overflow)
ZERO 0x0000000 Zero Value

The CARM library function _chkfloat_ allows you to quickly check the floating-point status of float numbers.

Note

  • Not a number (NaN) is represented by setting the exponent to the highest positive value and the mantissa to a non-zero value. The value of the sign bit is ignored.
  • Infinity (+INF or -INF) is represented by setting the exponent to the highest value and the mantissa to zero. The sign bit signifies positive or negative infinity.
  • Zero is represented by a zero sign, mantissa, and exponent.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.