IEEE 754 Support in TI Compilers

From Texas Instruments Wiki
Jump to: navigation, search

The IEEE Standard for Floating-Point Arithmetic (IEEE 754, also published as ISO/IEC/IEEE 60559:2011) is a widely-used standard for floating-point format and arithmetic.

The TI compilers for all devices support IEEE 754 floating-point arithmetic, whether or not those devices have native floating-point processing.

All current TI compilers support IEEE 754 32-bit and 64-bit formats; 64-bit format is not available in some modes (MSP430 COFF).

The TI compiler does not support every aspect of IEEE 754; in particular, it only attempts to support that portion of IEEE 754 required by the C standard. Technically, the C89 standard does not require IEEE 754 support, and for C99, full IEEE 754 support is optional. TI compilers support only 32- and 64-bit floating-point values. Not all targets support 64-bit floating-point values.

The support for IEEE 754 is of significantly different quality between devices which natively support IEEE 754 and those which do not. When the device does not natively support IEEE 754, these operations must be performed with helper functions located in the RTS library. These functions tend not to handle special values (Inf, NaN, denormal) correctly.

For devices that natively support IEEE 754, such as C6600 and Cortex-A8, the TI compiler-generated code is conformant to that part of IEEE 754 (ISO/IEC/IEEE 60559) available in C89 features, with the following caveats:

  • The --fp_mode=strict option must be specified
  • The --fp_reassoc=off option must be specified
  • Only one NaN, qNaN (quiet NaN) is supported
  • Only "round to nearest/even" mode is supported
  • The compiler might not preserve the "literal meaning" of some constant expressions which should raise a run-time FPE. In particular, "inexact" is not supported for constant expressions.
  • Exact precision (in particular, due to rounding) is only provided for fundamental operations (addition, multiplication, etc). For C library functions such as sin and cos, the results may not be correct to the last bit. This is a quality-of-implementation issue and does not impact IEEE 754 conformance.

The following are not currently supported:

  • C99 float rounding mode manipulation features
  • C99 floating-point exception manipulation features

See also

External references