COMPLEX — Complex conversion function#

COMPLEX(X, Y)#

COMPLEX(X, Y) returns a complex number where X is converted to the real component and Y is converted to the imaginary component.

Parameters:
  • X – The type may be INTEGER or REAL.

  • Y – The type may be INTEGER or REAL.

Returns:

If X and Y are both of INTEGER type, then the return value is of default COMPLEX type.

Standard:

GNU extension

Class:

Elemental function

Syntax:
RESULT = COMPLEX(X, Y)
Example:
program test_complex
    integer :: i = 42
    real :: x = 3.14
    print *, complex(i, x)
end program test_complex
See also:

CMPLX — Complex conversion function