Complex type manipulation functions

The functions described in this section are useful for efficiently manipulating complex data types, by allowing you to automatically convert real floating-point data to complex types, and to extract the real (primary) and imaginary (secondary) parts of complex values.

Table 11. Complex type manipulation functions
Function Convert dual reals to complex (single-precision): __cmplxf
Purpose Converts two single-precision real values to a single complex value. The real a is converted to the primary element of the return value, and the real b is converted to the secondary element of the return value.
Formula
primary(result) = a
secondary(result) = b
C/C++ prototype float _Complex __cmplxf (float a, float b);
Fortran description CMPLX(A,B)
where A is of type REAL(4)  
where B is of type REAL(4)
result is of type COMPLEX(4)
Function Convert dual reals to complex (double-precision): __cmplx
Purpose Converts two double-precision real values to a single complex value. The real a is converted to the primary element of the return value, and the real b is converted to the secondary element of the return value.
Formula
primary(result) = a
secondary(result) = b
C/C++ prototype
double _Complex __cmplx (double a, double b);
long double _Complex __cmplxl (long double a, long double b);1
Fortran description CMPLX(A,B)
where A is of type REAL(8)  
where B is of type REAL(8)
result is of type COMPLEX(8)
Function Extract real part of complex (single-precision): __crealf
Purpose Extracts the primary part of a single-precision complex value a , and returns the result as a single real value.
Formula result = primary(a)
C/C++ prototype float __crealf (float _Complex a);
Fortran description N/A
Function Extract real part of complex (double-precision): __creal, __creall
Purpose Extracts the primary part of a double-precision complex value a , and returns the result as a single real value.
Formula result = primary(a)
C/C++ prototype
double __creal (double _Complex a);
long double __creall (long double _Complex a);1
Fortran description N/A
Function Extract imaginary part of complex (single-precision): __cimagf
Purpose Extracts the secondary part of a single-precision complex value a , and returns the result as a single real value.
Formula result = secondary(a)
C/C++ prototype float __cimagf (float _Complex a);
Fortran description N/A
Function Extract imaginary part of complex (double-precision): __cimag, __cimagl
Purpose Extracts the imaginary part of a double-precision complex value a , and returns the result as a single real value.
Formula result =secondary(a)
C/C++ prototype double __cimag (double _Complex a); long double __cimagl (long double _Complex a);1
Fortran description N/A
Notes:
  1. 128-bit C/C++ long double types are not supported on Blue Gene/L. Long doubles are treated as regular double-precision doubles.