CMPLX
— Complex conversion functionCMPLX(X [, Y [, KIND]])
returns a 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. RESULT = CMPLX(X [, Y [, KIND]])
X | The type may be INTEGER , REAL , or COMPLEX . |
Y | (Optional; only allowed if X is not COMPLEX .) May be INTEGER or REAL . |
KIND | (Optional) An INTEGER initialization expression indicating the kind parameter of the result. |
COMPLEX
type, with a kind equal to KIND if it is specified. If KIND is not specified, the result is of the default COMPLEX
kind, regardless of the kinds of X and Y. program test_cmplx integer :: i = 42 real :: x = 3.14 complex :: z z = cmplx(i, x) print *, z, cmplx(x) end program test_cmplx
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gfortran/CMPLX.html