]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/atan2.3
Many pages: Fix style issues reported by `make lint-groff`
[thirdparty/man-pages.git] / man3 / atan2.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .\" References consulted:
8 .\" Linux libc source code
9 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10 .\" 386BSD man pages
11 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
12 .\" Modified 2002-07-27 by Walter Harms
13 .\" (walter.harms@informatik.uni-oldenburg.de)
14 .\"
15 .TH ATAN2 3 2021-03-22 GNU "Linux Programmer's Manual"
16 .SH NAME
17 atan2, atan2f, atan2l \- arc tangent function of two variables
18 .SH LIBRARY
19 Math library
20 .RI ( libm ", " \-lm )
21 .SH SYNOPSIS
22 .nf
23 .B #include <math.h>
24 .PP
25 .BI "double atan2(double " y ", double " x );
26 .BI "float atan2f(float " y ", float " x );
27 .BI "long double atan2l(long double " y ", long double " x );
28 .fi
29 .PP
30 .RS -4
31 Feature Test Macro Requirements for glibc (see
32 .BR feature_test_macros (7)):
33 .RE
34 .PP
35 .BR atan2f (),
36 .BR atan2l ():
37 .nf
38 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
39 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
40 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
41 .fi
42 .SH DESCRIPTION
43 These functions calculate the principal value of the arc tangent of
44 .IR y/x ,
45 using the signs of the two arguments to determine
46 the quadrant of the result.
47 .SH RETURN VALUE
48 On success, these functions return the principal value of the arc tangent of
49 .I y/x
50 in radians; the return value is in the range [\-pi,\ pi].
51 .PP
52 If
53 .I y
54 is +0 (\-0) and
55 .I x
56 is less than 0, +pi (\-pi) is returned.
57 .PP
58 If
59 .I y
60 is +0 (\-0) and
61 .I x
62 is greater than 0, +0 (\-0) is returned.
63 .PP
64 If
65 .I y
66 is less than 0 and
67 .I x
68 is +0 or \-0, \-pi/2 is returned.
69 .PP
70 If
71 .I y
72 is greater than 0 and
73 .I x
74 is +0 or \-0, pi/2 is returned.
75 .PP
76 .\" POSIX.1 says:
77 .\" If
78 .\" .I x
79 .\" is 0, a pole error shall not occur.
80 .\"
81 If either
82 .I x
83 or
84 .I y
85 is NaN, a NaN is returned.
86 .PP
87 .\" POSIX.1 says:
88 .\" If the result underflows, a range error may occur and
89 .\" .I y/x
90 .\" should be returned.
91 .\"
92 If
93 .I y
94 is +0 (\-0) and
95 .I x
96 is \-0, +pi (\-pi) is returned.
97 .PP
98 If
99 .I y
100 is +0 (\-0) and
101 .I x
102 is +0, +0 (\-0) is returned.
103 .PP
104 If
105 .I y
106 is a finite value greater (less) than 0, and
107 .I x
108 is negative infinity, +pi (\-pi) is returned.
109 .PP
110 If
111 .I y
112 is a finite value greater (less) than 0, and
113 .I x
114 is positive infinity, +0 (\-0) is returned.
115 .PP
116 If
117 .I y
118 is positive infinity (negative infinity), and
119 .I x
120 is finite,
121 pi/2 (\-pi/2) is returned.
122 .PP
123 If
124 .I y
125 is positive infinity (negative infinity) and
126 .I x
127 is negative infinity, +3*pi/4 (\-3*pi/4) is returned.
128 .PP
129 If
130 .I y
131 is positive infinity (negative infinity) and
132 .I x
133 is positive infinity, +pi/4 (\-pi/4) is returned.
134 .\"
135 .\" POSIX.1 says:
136 .\" If both arguments are 0, a domain error shall not occur.
137 .SH ERRORS
138 No errors occur.
139 .\" POSIX.1 documents an optional underflow error
140 .\" glibc 2.8 does not do this.
141 .SH ATTRIBUTES
142 For an explanation of the terms used in this section, see
143 .BR attributes (7).
144 .ad l
145 .nh
146 .TS
147 allbox;
148 lbx lb lb
149 l l l.
150 Interface Attribute Value
151 T{
152 .BR atan2 (),
153 .BR atan2f (),
154 .BR atan2l ()
155 T} Thread safety MT-Safe
156 .TE
157 .hy
158 .ad
159 .sp 1
160 .SH CONFORMING TO
161 C99, POSIX.1-2001, POSIX.1-2008.
162 .PP
163 The variant returning
164 .I double
165 also conforms to
166 SVr4, 4.3BSD, C89.
167 .SH SEE ALSO
168 .BR acos (3),
169 .BR asin (3),
170 .BR atan (3),
171 .BR carg (3),
172 .BR cos (3),
173 .BR sin (3),
174 .BR tan (3)