]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
1 | .. |
2 | Copyright 1988-2022 Free Software Foundation, Inc. | |
3 | This is part of the GCC manual. | |
4 | For copying conditions, see the copyright.rst file. | |
5 | ||
6 | .. _dcmplx: | |
7 | ||
8 | DCMPLX --- Double complex conversion function | |
9 | ********************************************* | |
10 | ||
11 | .. index:: DCMPLX, complex numbers, conversion to, conversion, to complex | |
12 | ||
13 | .. function:: DCMPLX(X, Y) | |
14 | ||
15 | ``DCMPLX(X [,Y])`` returns a double complex number where :samp:`{X}` is | |
16 | converted to the real component. If :samp:`{Y}` is present it is converted to the | |
17 | imaginary component. If :samp:`{Y}` is not present then the imaginary component is | |
18 | set to 0.0. If :samp:`{X}` is complex then :samp:`{Y}` must not be present. | |
19 | ||
20 | :param X: | |
21 | The type may be ``INTEGER``, ``REAL``, | |
22 | or ``COMPLEX``. | |
23 | ||
24 | :param Y: | |
25 | (Optional if :samp:`{X}` is not ``COMPLEX``.) May be | |
26 | ``INTEGER`` or ``REAL``. | |
27 | ||
28 | :return: | |
29 | The return value is of type ``COMPLEX(8)`` | |
30 | ||
31 | Standard: | |
32 | GNU extension | |
33 | ||
34 | Class: | |
35 | Elemental function | |
36 | ||
37 | Syntax: | |
38 | .. code-block:: fortran | |
39 | ||
40 | RESULT = DCMPLX(X [, Y]) | |
41 | ||
42 | Example: | |
43 | .. code-block:: fortran | |
44 | ||
45 | program test_dcmplx | |
46 | integer :: i = 42 | |
47 | real :: x = 3.14 | |
48 | complex :: z | |
49 | z = cmplx(i, x) | |
50 | print *, dcmplx(i) | |
51 | print *, dcmplx(x) | |
52 | print *, dcmplx(z) | |
53 | print *, dcmplx(x,i) | |
3ed1b4ce | 54 | end program test_dcmplx |