Debian Codegraph @

upstream/debian-unstable/man3/atan2.3

raw
1 '\" t
2 .\" Copyright 1993, David Metcalfe <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH atan2 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 atan2, atan2f, atan2l \- arc tangent function of two variables
10 .SH LIBRARY
11 Math library
12 .RI ( libm ,\~ \-lm )
13 .SH SYNOPSIS
14 .nf
15 .B #include <math.h>
16 .P
17 .BI "double atan2(double " y ", double " x );
18 .BI "float atan2f(float " y ", float " x );
19 .BI "long double atan2l(long double " y ", long double " x );
20 .fi
21 .P
22 .RS -4
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
25 .RE
26 .P
27 .BR atan2f (),
28 .BR atan2l ():
29 .nf
30 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
31 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
32 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
33 .fi
34 .SH DESCRIPTION
35 These functions calculate the principal value of the arc tangent of
36 .IR y/x ,
37 using the signs of the two arguments to determine
38 the quadrant of the result.
39 .SH RETURN VALUE
40 On success,
41 these functions return the principal value of the arc tangent of
42 .I y/x
43 in radians;
44 the return value is in the range [\-pi,\ pi].
45 .P
46 If
47 .I y
48 is +0 (\-0) and
49 .I x
50 is less than 0, +pi (\-pi) is returned.
51 .P
52 If
53 .I y
54 is +0 (\-0) and
55 .I x
56 is greater than 0, +0 (\-0) is returned.
57 .P
58 If
59 .I y
60 is less than 0 and
61 .I x
62 is +0 or \-0, \-pi/2 is returned.
63 .P
64 If
65 .I y
66 is greater than 0 and
67 .I x
68 is +0 or \-0, pi/2 is returned.
69 .P
70 .\" POSIX.1 says:
71 .\" If
72 .\" .I x
73 .\" is 0, a pole error shall not occur.
74 .\"
75 If either
76 .I x
77 or
78 .I y
79 is NaN, a NaN is returned.
80 .P
81 .\" POSIX.1 says:
82 .\" If the result underflows, a range error may occur and
83 .\" .I y/x
84 .\" should be returned.
85 .\"
86 If
87 .I y
88 is +0 (\-0) and
89 .I x
90 is \-0, +pi (\-pi) is returned.
91 .P
92 If
93 .I y
94 is +0 (\-0) and
95 .I x
96 is +0, +0 (\-0) is returned.
97 .P
98 If
99 .I y
100 is a finite value greater (less) than 0, and
101 .I x
102 is negative infinity, +pi (\-pi) is returned.
103 .P
104 If
105 .I y
106 is a finite value greater (less) than 0, and
107 .I x
108 is positive infinity, +0 (\-0) is returned.
109 .P
110 If
111 .I y
112 is positive infinity (negative infinity), and
113 .I x
114 is finite,
115 pi/2 (\-pi/2) is returned.
116 .P
117 If
118 .I y
119 is positive infinity (negative infinity) and
120 .I x
121 is negative infinity, +3*pi/4 (\-3*pi/4) is returned.
122 .P
123 If
124 .I y
125 is positive infinity (negative infinity) and
126 .I x
127 is positive infinity, +pi/4 (\-pi/4) is returned.
128 .\"
129 .\" POSIX.1 says:
130 .\" If both arguments are 0, a domain error shall not occur.
131 .SH ERRORS
132 No errors occur.
133 .\" POSIX.1 documents an optional underflow error
134 .\" glibc 2.8 does not do this.
135 .SH ATTRIBUTES
136 For an explanation of the terms used in this section, see
137 .BR attributes (7).
138 .TS
139 allbox;
140 lbx lb lb
141 l l l.
142 Interface Attribute Value
143 T{
144 .na
145 .nh
146 .BR atan2 (),
147 .BR atan2f (),
148 .BR atan2l ()
149 T} Thread safety MT-Safe
150 .TE
151 .SH STANDARDS
152 C11, POSIX.1-2008.
153 .SH HISTORY
154 C99, POSIX.1-2001.
155 .P
156 The variant returning
157 .I double
158 also conforms to
159 SVr4, 4.3BSD, C89.
160 .SH SEE ALSO
161 .BR acos (3),
162 .BR asin (3),
163 .BR atan (3),
164 .BR carg (3),
165 .BR cos (3),
166 .BR sin (3),
167 .BR tan (3)