]> gcc.gnu.org Git - gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/sqrt.rst
sphinx: copy files from texi2rst-generated repository
[gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / sqrt.rst
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 .. _sqrt:
7
8 .. index:: SQRT
9
10 .. index:: DSQRT
11
12 .. index:: CSQRT
13
14 .. index:: ZSQRT
15
16 .. index:: CDSQRT
17
18 .. index:: root
19
20 .. index:: square-root
21
22 SQRT --- Square-root function
23 *****************************
24
25 .. function:: SQRT(X)
26
27 ``SQRT(X)`` computes the square root of :samp:`{X}`.
28
29 :param X:
30 The type shall be ``REAL`` or
31 ``COMPLEX``.
32
33 :return:
34 The return value is of type ``REAL`` or ``COMPLEX``.
35 The kind type parameter is the same as :samp:`{X}`.
36
37 Standard:
38 Fortran 77 and later
39
40 Class:
41 Elemental function
42
43 Syntax:
44 .. code-block:: fortran
45
46 RESULT = SQRT(X)
47
48 Example:
49 .. code-block:: fortran
50
51 program test_sqrt
52 real(8) :: x = 2.0_8
53 complex :: z = (1.0, 2.0)
54 x = sqrt(x)
55 z = sqrt(z)
56 end program test_sqrt
57
58 Specific names:
59 .. list-table::
60 :header-rows: 1
61
62 * - Name
63 - Argument
64 - Return type
65 - Standard
66
67 * - ``SQRT(X)``
68 - ``REAL(4) X``
69 - ``REAL(4)``
70 - Fortran 77 and later
71 * - ``DSQRT(X)``
72 - ``REAL(8) X``
73 - ``REAL(8)``
74 - Fortran 77 and later
75 * - ``CSQRT(X)``
76 - ``COMPLEX(4) X``
77 - ``COMPLEX(4)``
78 - Fortran 77 and later
79 * - ``ZSQRT(X)``
80 - ``COMPLEX(8) X``
81 - ``COMPLEX(8)``
82 - GNU extension
83 * - ``CDSQRT(X)``
84 - ``COMPLEX(8) X``
85 - ``COMPLEX(8)``
86 - GNU extension
This page took 0.04048 seconds and 5 git commands to generate.