Complex Literals

A complex literal type represents a complex number. The predefined macro _Complex_I represents a constant expression of type const float _Complex with the value of the imaginary unit. For example,

float _Complex varComplex = 2.0f + 2.0f*_Complex_I;

initializes the variable varComplex to type float _Complex.

The complex type can also be indicated by one of the suffixes: i, I, j, or J. The real part of the complex number can be indicated by one of the suffixes: f, F, l, or L. These suffixes are extensions of C99 for ease of porting applications developed with GNU C.

The simplified syntax for a complex literal is:

>>-| floating-constant |--| complex-suffix |-------------------><
 
floating-constant:
 
|--+-decimal-floating-constant-----+----------------------------|
   '-hexadecimal-floating-constant-'
 
complex-suffix:
 
|--+-+-----------------+--suffixij-+----------------------------|
   | '-floating-suffix-'           |
   '-suffixij--+-----------------+-'
               '-floating-suffix-'
 
 

where

floating-suffix
is one of f, F, l (lowercase el) or L.

The suffixes f or F indicates a complex literal of type float _Complex. The suffixes l or L indicates a complex literal of type long double _Complex. A complex literal is of type double _Complex in the absense of suffixes.

suffixij
is one of i, I, j, J.

Related References

IBM Copyright 2003