Keil™, An ARM® Company

CARM User's Guide

Discontinued

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.

NameValueMeaning
NaN0xFFFFFFFNot a Number
+INF0x7F80000Positive Infinity (positive overflow)
-INF0xFF80000Negative Infinity (negative overflow)
ZERO0x0000000Zero 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.