Description: | Converts the argument to complex type. This function must not be passed as an actual argument. | ||
Class: | Elemental function; Generic | ||
Arguments: | X | Must be of type integer, real, or complex. | |
Y (opt) | Must be of type integer or real. It must not be present if X is of type complex. | ||
KIND (opt) | Must be a scalar integer initialization expression. | ||
Results: | The
result is of type complex (COMPLEX(4) or
COMPLEX*8). If KIND is present, the kind parameter is that
specified by KIND; otherwise, the kind parameter is that of default
real type.
If only one noncomplex argument appears, it is converted into the real part of the result value and zero is assigned to the imaginary part. If Y is not specified and X is complex, the result value is CMPLX (REAL(X), AIMAG(X)). If two noncomplex arguments appear, the complex value is produced by converting the first argument into the real part of the value, and converting the second argument into the imaginary part. CMPLX(X, Y, KIND) has the complex value whose real part is REAL(X, KIND) and whose imaginary part is REAL(Y, KIND). The setting of compiler options specifying real size can affect this function. |
Examples
CMPLX (-3) has the value (-3.0, 0.0).
CMPLX (4.1, 2.3) has the value (4.1, 2.3).