Next: CO_BROADCAST, Previous: CHMOD, Up: Intrinsic Procedures [Contents][Index]
9.62 CMPLX — Complex conversion function
- Description:
 CMPLX(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.- Standard:
 Fortran 77 and later
- Class:
 Elemental function
- Syntax:
 RESULT = CMPLX(X [, Y [, KIND]])- Arguments:
 X The type may be INTEGER,REAL, orCOMPLEX.Y (Optional; only allowed if X is not COMPLEX.) May beINTEGERorREAL.KIND (Optional) An INTEGERinitialization expression indicating the kind parameter of the result.- Return value:
 The return value is of
COMPLEXtype, with a kind equal to KIND if it is specified. If KIND is not specified, the result is of the defaultCOMPLEXkind, regardless of the kinds of X and Y.- Example:
 program test_cmplx integer :: i = 42 real :: x = 3.14 complex :: z z = cmplx(i, x) print *, z, cmplx(x) end program test_cmplx- See also:
 
    
