You copied the Doc URL to your clipboard.


Enables the use of half-precision floating-point numbers as an optional extension to the VFPv3 architecture. If a format is not specified, use of the __fp16 data type is faulted by the compiler.



Where format is one of:


An alternative to ieee that provides additional range, but has no NaN or infinity values.


Half-precision binary floating-point format defined by IEEE 754r, a revision to the IEEE 754 standard.


This is the default setting. It is equivalent to not specifying a format and means that the compiler faults use of the __fp16 data type.


The following restrictions apply when you use the __fp16 data type:

  • When used in a C or C++ expression, an __fp16 type is promoted to single precision. Subsequent promotion to double precision can occur if required by one of the operands.

  • A single precision value can be converted to __fp16. A double precision value is converted to single precision and then to __fp16, that could involve double rounding. This reflects the lack of direct double-to-16-bit conversion in the ARM architecture.

  • When using fpmode=fast, no floating-point exceptions are raised when converting to and from half-precision floating-point format.

  • Function formal arguments cannot be of type __fp16. However, pointers to variables of type __fp16 can be used as function formal argument types.

  • __fp16 values can be passed as actual function arguments. In this case, they are converted to single-precision values.

  • __fp16 cannot be specified as the return type of a function. However, a pointer to an __fp16 type can be used as a return type.

  • An __fp16 value is converted to a single-precision or double-precision value when used as a return value for a function that returns a float or double.