DCMPLX - The GNU Fortran Compiler
Description: The GNU Fortran Compiler

Next: DIGITS, Previous: DBLE, Up: Intrinsic Procedures

### 8.63 `DCMPLX` — Double complex conversion function

Description:
  `DCMPLX(X [,Y])` returns a double complex number where X is converted to the real component. If Y is present it is converted to the imaginary component. If Y is not present then the imaginary component is set to 0.0. If X is complex then Y must not be present.
Standard:
  GNU extension
Class:
  Elemental function
Syntax:
  `RESULT = DCMPLX(X [, Y])`
Arguments:

  X | The type may be `INTEGER`, `REAL`, or `COMPLEX`.
  Y | (Optional if X is not `COMPLEX`.) May be `INTEGER` or `REAL`.

Return value:
  The return value is of type `COMPLEX(8)`
Example:

                program test_dcmplx
                    integer :: i = 42
                    real :: x = 3.14
                    complex :: z
                    z = cmplx(i, x)
                    print *, dcmplx(i)
                    print *, dcmplx(x)
                    print *, dcmplx(z)
                    print *, dcmplx(x,i)
                end program test_dcmplx