Convert to complex type.

**X**- must be of type integer, real, or complex.
**Y (optional)**- must be of type integer or real. It must not be present if X is of type complex.
**KIND (optional)**- must be a scalar integer initialization expression.

**Class**

Elemental function

**Result Type and Attributes**

- It is of type complex.
- If KIND is present, the kind type parameter is that specified by KIND; otherwise, the kind type parameter is that of the default real type.

**Result Value**

- If Y is absent and X is not complex, it is as if Y were present with the value zero.
- If Y is absent and X is complex, it is as if Y were present with the value AIMAG(X).
- CMPLX(X, Y, KIND) has the complex value whose real part is REAL(X, KIND) and whose imaginary part is REAL(Y, KIND).

**Examples**

CMPLX (-3) has the value (-3.0, 0.0).

Specific Name | Argument Type | Result Type | Pass As Arg? |
---|---|---|---|

CMPLX (1)
| default real | default complex | no |

**Notes: **

- IBM Extension.

**Related Information**