Using the GNU Compiler Collection (GCC): Floating Types

Next: Half-Precision, Previous: Complex, Up: C Extensions [Contents][Index]

### 6.11 Additional Floating Types

As an extension, GNU C supports additional floating types, `__float80` and `__float128` to support 80-bit (`XFmode`) and 128-bit (`TFmode`) floating types. Support for 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`.

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;

In order to use `__float128` and `__ibm128` on PowerPC Linux systems, you must use the `-mfloat128`. It is expected in future versions of GCC that `__float128` will be enabled automatically. In addition, there are currently problems in using the complex `__float128` type. When these problems are fixed, you would use the following syntax to declare `_Complex128` to be a complex `__float128` type:

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;

Not all targets support additional floating-point types. `__float80` and `__float128` types are supported on x86 and IA-64 targets. The `__float128` type is supported on hppa HP-UX. The `__float128` type is supported on PowerPC 64-bit Linux systems by default if the vector scalar instruction set (VSX) is enabled.

On the PowerPC, `__ibm128` provides access to the IBM extended double format, and it is intended to be used by the library functions that handle conversions if/when long double is changed to be IEEE 128-bit floating point.

Next: Half-Precision, Previous: Complex, Up: C Extensions [Contents][Index]