]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/atan2.3
random.4: spfix
[thirdparty/man-pages.git] / man3 / atan2.3
CommitLineData
fea681da 1.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
f71288ac
MK
2.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3.\" <mtk.manpages@gmail.com>
fea681da
MK
4.\"
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
c13182ef 13.\"
fea681da
MK
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
c13182ef 21.\"
fea681da
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
24.\"
25.\" References consulted:
26.\" Linux libc source code
27.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28.\" 386BSD man pages
29.\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
30.\" Modified 2002-07-27 by Walter Harms
31.\" (walter.harms@informatik.uni-oldenburg.de)
32.\"
50831f9b 33.TH ATAN2 3 2010-09-20 "" "Linux Programmer's Manual"
fea681da
MK
34.SH NAME
35atan2, atan2f, atan2l \- arc tangent function of two variables
36.SH SYNOPSIS
37.nf
38.B #include <math.h>
1cdac39d 39
fea681da 40.BI "double atan2(double " y ", double " x );
fea681da 41.BI "float atan2f(float " y ", float " x );
fea681da 42.BI "long double atan2l(long double " y ", long double " x );
1cdac39d 43
fea681da 44.fi
20c58d70 45Link with \fI\-lm\fP.
f71288ac
MK
46.sp
47.in -4n
48Feature Test Macro Requirements for glibc (see
49.BR feature_test_macros (7)):
50.in
51.sp
52.ad l
53.BR atan2f (),
54.BR atan2l ():
fd39aa34 55.RS
8b0d34e4
MK
56_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
57_POSIX_C_SOURCE\ >=\ 200112L;
fd39aa34
MK
58.br
59or
f71288ac 60.I cc\ -std=c99
fd39aa34 61.RE
f71288ac 62.ad b
fea681da 63.SH DESCRIPTION
60a90ecd
MK
64The
65.BR atan2 ()
f71288ac
MK
66function calculates the principal value of the arc tangent of
67.IR y/x ,
68using the signs of the two arguments to determine
69the quadrant of the result.
fea681da 70.SH "RETURN VALUE"
f71288ac
MK
71On success, these functions return the principal value of the arc tangent of
72.IR y/x
d62d92dc 73in radians; the return value is in the range [\-pi,\ pi].
f71288ac
MK
74
75If
76.I y
77is +0 (\-0) and
78.I x
79is less than 0, +pi (\-pi) is returned.
80
81If
82.I y
83is +0 (\-0) and
84.I x
85is greater than 0, +0 (\-0) is returned.
86
87If
88.I y
89is less than 0 and
90.I x
91is +0 or \-0, \-pi/2 is returned.
92
93If
94.I y
95is greater than 0 and
96.I x
97is +0 or \-0, pi/2 is returned.
98
99.\" POSIX.1 says:
100.\" If
101.\" .I x
102.\" is 0, a pole error shall not occur.
103.\"
104If either
105.I x
106or
107.I y
108is NaN, a NaN is returned.
109
110.\" POSIX.1 says:
4e836144 111.\" If the result underflows, a range error may occur and
f71288ac
MK
112.\" .I y/x
113.\" should be returned.
114.\"
115If
116.I y
117is +0 (\-0) and
118.I x
119is \-0, +pi (\-pi) is returned.
120
121If
122.I y
123is +0 (\-0) and
124.I x
125is +0, +0 (\-0) is returned.
126
127If
128.I y
129is a finite value greater (less) than 0, and
130.I x
131is negative infinity, +pi (\-pi) is returned.
132
133If
134.I y
135is a finite value greater (less) than 0, and
136.I x
137is positive infinity, +0 (\-0) is returned.
138
139If
140.I y
141is positive infinity (negative infinity), and
142.I x
143is finite,
144pi/2 (\-pi/2) is returned.
145
146If
147.I y
148is positive infinity (negative infinity) and
149.I x
c3074d70 150is negative infinity, +3*pi/4 (\-3*pi/4) is returned.
f71288ac
MK
151
152If
153.I y
154is positive infinity (negative infinity) and
155.I x
c3074d70 156is positive infinity, +pi/4 (\-pi/4) is returned.
f71288ac
MK
157.\"
158.\" POSIX.1 says:
159.\" If both arguments are 0, a domain error shall not occur.
160.SH ERRORS
161No errors occur.
162.\" POSIX.1 documents an optional underflow error
163.\" glibc 2.8 does not do this.
fea681da 164.SH "CONFORMING TO"
f71288ac
MK
165C99, POSIX.1-2001.
166The variant returning
167.I double
168also conforms to
f71288ac 169SVr4, 4.3BSD, C89.
fea681da
MK
170.SH "SEE ALSO"
171.BR acos (3),
172.BR asin (3),
173.BR atan (3),
a1759255 174.BR carg (3),
fea681da
MK
175.BR cos (3),
176.BR sin (3),
177.BR tan (3)