9.71 COMPLEX — Complex conversion function
- Description:
-
COMPLEX(X, Y)
returns a complex number where X is converted to the real component and Y is converted to the imaginary component. - Standard:
-
GNU extension
- Class:
-
Elemental function
- Syntax:
-
RESULT = COMPLEX(X, Y)
- Arguments:
-
X The type may be INTEGER
orREAL
.Y The type may be INTEGER
orREAL
. - Return value:
-
If X and Y are both of
INTEGER
type, then the return value is of defaultCOMPLEX
type.If X and Y are of
REAL
type, or one is ofREAL
type and one is ofINTEGER
type, then the return value is ofCOMPLEX
type with a kind equal to that of theREAL
argument with the highest precision. - Example:
-
program test_complex integer :: i = 42 real :: x = 3.14 print *, complex(i, x) end program test_complex
- See also:
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gfortran/COMPLEX.html