floating point types

floating point type specifiers fall into the following categories:

Real floating point types

Generic, or binary, floating point types consist of the following:
  • float
  • double
  • long double
The magnitude ranges of the real floating point types are given in the following table.
Table 1. Magnitude ranges of real floating point types
Type Range
float approximately 1.2-38 to 3.438
double, long double approximately 2.2-308 to 1.8308
If a floating point constant is too large or too small, the result is undefined by the language.

The declarator for a simple floating point declaration is an identifier. Initialize a simple floating point variable with a float constant or with a variable or expression that evaluates to an integer or floating point number.

Complex floating point types

The complex type specifiers are:
  • float _Complex
  • double _Complex
  • long double _Complex

The representation and alignment requirements of a complex type are the same as an array type containing two elements of the corresponding real type. The real part is equal to the first element; the imaginary part is equal to the second element.

The equality and inequality operators have the same behavior as for real types. None of the relational operators may have a complex type as an operand.

IBM extension As an extension to C99 and Standard C++, complex numbers may also be operands to the unary operators ++ (increment), -- (decrement), and ~ (bitwise negation).