Debian Codegraph @

doc/src/intrinsics/mathematical/acos.md

raw
1 # acos(x): Trigonometric Arc Cosine
2
3 Trigonometric arc cosine (inverse cosine) function.
4
5 ## Declaration
6
7 ### Syntax
8
9 ```fortran
10 retval = acos(x)
11 elemental real(p) function acos(x)
12 elemental complex(p) function acos(x)
13 ```
14 ### Arguments
15
16 `x` the input value, can be real or complex; less than or equal to 1.
17
18 ### Return values
19
20 The returned value has the kind of the input value and TYPE may be real
21 or complex.
22
23 ## Description
24
25 **acos(x)** computes the arcsine of the argument **x**.
26
27 The arc cosine is the inverse function of the cosine function. It is commonly used in
28 trigonometry to find the angle when the lengths of the hypotenuse and the
29 base side of a right triangle are known.
30
31 ## Types
32
33 Supported argument types float, double, complex float, complex double.
34
35 ```fortran
36 interface acos
37 module procedure sacos, dacos, cacos, zacos
38 end interface
39
40 contains
41
42 interface
43 elemental real(sp) function sacos(x)
44 real(sp), intent(in) :: x
45 end function
46
47 elemental real(dp) function dacos(x)
48 real(dp), intent(in) :: x
49 end function
50
51 elemental complex(sp) function cacos(x)
52 complex(sp), intent(in) :: x
53 end function
54
55 elemental complex(dp) function zacos(x)
56 complex(dp), intent(in) :: x
57 end function
58 end interface
59 ```
60 ## Examples
61
62 ```fortran
63 program intrinsics_acos
64 implicit none
65 integer, parameter :: arg_x = kind(0.0)
66 real(arg_x) :: x1
67 real :: retval_x
68 real :: arg_x
69 retval_x = acos(0.84147098)
70 print *, ret_val_x
71 retval_x = acos(x1)
72 print *, ret_val_x
73 end program
74 ```
75
76 **Result**:
77
78 ```
79 0.570796336
80 0.570796336
81 ```
82 ## See Also
83
84 [asin](asin.md), [atan](atan.md).