Floating-point types

Floating-point type specifiers fall into the following categories:

The magnitude range of float is approximately 1.2e-38 to 3.4e38. The magnitude range of double or long double is approximately 2.2e-308 to 1.8e308. 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.

Note:
If you do not add the f suffix to a floating-point literal, that number will be of type double. If you initialize an object of type float with an object of type double, the compiler will implicitly convert the object of type double to an object of type float.

Related information

Complex floating-point types

The complex type specifiers are:

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).

Related information