Next: , Previous: Complex, Up: C Extensions


6.11 Additional Floating Types

ISO/IEC TS 18661-3:2015 defines C support for additional floating types _Floatn and _Floatnx, and GCC supports these type names; the set of types supported depends on the target architecture. These types are not supported when compiling C++. Constants with these types use suffixes fn or Fn and fnx or Fnx. These type names can be used together with _Complex to declare complex types.

As an extension, GNU C and GNU C++ support additional floating types, which are not supported by all targets.

Support for these additional types includes the arithmetic operators: add, subtract, multiply, divide; unary arithmetic operators; relational operators; equality operators; and conversions to and from integer and other floating types. Use a suffix ‘w’ or ‘W’ in a literal constant of type __float80 or type __ibm128. Use a suffix ‘q’ or ‘Q’ for _float128.

In order to use _Float128, __float128, and __ibm128 on PowerPC Linux systems, you must use the -mfloat128 option. It is expected in future versions of GCC that _Float128 and __float128 will be enabled automatically.

The _Float128 type is supported on all systems where __float128 is supported or where long double has the IEEE binary128 format. The _Float64x type is supported on all systems where __float128 is supported. The _Float32 type is supported on all systems supporting IEEE binary32; the _Float64 and _Float32x types are supported on all systems supporting IEEE binary64. The _Float16 type is supported on AArch64 systems by default, and on ARM systems when the IEEE format for 16-bit floating-point types is selected with -mfp16-format=ieee. GCC does not currently support _Float128x on any systems.

On the i386, x86_64, IA-64, and HP-UX targets, you can declare complex types using the corresponding internal complex type, XCmode for __float80 type and TCmode for __float128 type:

     typedef _Complex float __attribute__((mode(TC))) _Complex128;
     typedef _Complex float __attribute__((mode(XC))) _Complex80;

On the PowerPC Linux VSX targets, you can declare complex types using the corresponding internal complex type, KCmode for __float128 type and ICmode for __ibm128 type:

     typedef _Complex float __attribute__((mode(KC))) _Complex_float128;
     typedef _Complex float __attribute__((mode(IC))) _Complex_ibm128;