COMPLEX — Complex conversion function#
-
COMPLEX(X, Y)#
COMPLEX(X, Y)
returns a complex number whereX
is converted to the real component andY
is converted to the imaginary component.- Parameters
X – The type may be
INTEGER
orREAL
.Y – The type may be
INTEGER
orREAL
.
- Returns
If
X
andY
are both ofINTEGER
type, then the return value is of defaultCOMPLEX
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: