[UP]


Manual Reference Pages  - cmplx (3)

NAME

cmplx(3f) - [FORTRAN:INTRINSIC:NUMERIC] Complex conversion function

CONTENTS

Syntax
Description
Arguments
Return Value
Example
Standard
Class

SYNTAX

result = cmplx(x [, y [, kind]])

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.

ARGUMENTS

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.

RETURN VALUE

The return value is of 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.

EXAMPLE

Sample program:

    program demo_cmplx
        integer :: i = 42
        real :: x = 3.14
        complex :: z
        z = cmplx(i, x)
        print *, z, cmplx(x)
    end program demo_cmplx

STANDARD

[[FORTRAN 77]] and later

CLASS

[[Elemental procedure|Elemental function]]


cmplx (3) March 18, 2019
Generated by manServer 1.08 from fceab276-6494-4079-b75e-b2b6d895f975 using man macros.