]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/atan2d.rst
sphinx: copy files from texi2rst-generated repository
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / atan2d.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 .. _atan2d:
7
8 .. index:: ATAN2D
9
10 .. index:: DATAN2D
11
12 .. index:: trigonometric function, tangent, inverse, degrees
13
14 .. index:: tangent, inverse, degrees
15
16 ATAN2D --- Arctangent function, degrees
17 ***************************************
18
19 .. function:: ATAN2D(Y, X)
20
21 ``ATAN2D(Y, X)`` computes the principal value of the argument
22 function of the complex number X + i Y in degrees. This function can
23 be used to transform from Cartesian into polar coordinates and
24 allows to determine the angle in the correct quadrant.
25
26 :param Y:
27 The type shall be ``REAL``.
28
29 :param X:
30 The type and kind type parameter shall be the same as :samp:`{Y}`.
31 If :samp:`{Y}` is zero, then :samp:`{X}` must be nonzero.
32
33 :return:
34 The return value has the same type and kind type parameter as :samp:`{Y}`. It
35 is the principal value of the complex number X + i Y. If :samp:`{X}`
36 is nonzero, then it lies in the range -180 \le \atan (x) \leq 180.
37 The sign is positive if :samp:`{Y}` is positive. If :samp:`{Y}` is zero, then
38 the return value is zero if :samp:`{X}` is strictly positive, 180 if
39 :samp:`{X}` is negative and :samp:`{Y}` is positive zero (or the processor does
40 not handle signed zeros), and -180 if :samp:`{X}` is negative and
41 :samp:`{Y}` is negative zero. Finally, if :samp:`{X}` is zero, then the
42 magnitude of the result is 90.
43
44 Standard:
45 GNU extension, enabled with :option:`-fdec-math`.
46
47 Class:
48 Elemental function
49
50 Syntax:
51 .. code-block:: fortran
52
53 RESULT = ATAN2D(Y, X)
54
55 Example:
56 .. code-block:: fortran
57
58 program test_atan2d
59 real(4) :: x = 1.e0_4, y = 0.5e0_4
60 x = atan2d(y,x)
61 end program test_atan2d
62
63 Specific names:
64 .. list-table::
65 :header-rows: 1
66
67 * - Name
68 - Argument
69 - Return type
70 - Standard
71
72 * - ``ATAN2D(X, Y)``
73 - ``REAL(4) X, Y``
74 - ``REAL(4)``
75 - GNU extension
76 * - ``DATAN2D(X, Y)``
77 - ``REAL(8) X, Y``
78 - ``REAL(8)``
79 - GNU extension
80
81 See also:
82 Alias:
83 :ref:`ATAND`
84 Radians function:
85 :ref:`ATAN2`