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