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>
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\" References consulted:
8 .\" Linux libc source code
9 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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)
15 .TH ATAN2 3 2021-03-22 GNU "Linux Programmer's Manual"
17 atan2, atan2f, atan2l \- arc tangent function of two variables
20 .RI ( libm ", " \-lm )
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 );
31 Feature Test Macro Requirements for glibc (see
32 .BR feature_test_macros (7)):
38 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
39 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
40 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
43 These functions calculate the principal value of the arc tangent of
45 using the signs of the two arguments to determine
46 the quadrant of the result.
48 On success, these functions return the principal value of the arc tangent of
50 in radians; the return value is in the range [\-pi,\ pi].
56 is less than 0, +pi (\-pi) is returned.
62 is greater than 0, +0 (\-0) is returned.
68 is +0 or \-0, \-pi/2 is returned.
74 is +0 or \-0, pi/2 is returned.
79 .\" is 0, a pole error shall not occur.
85 is NaN, a NaN is returned.
88 .\" If the result underflows, a range error may occur and
90 .\" should be returned.
96 is \-0, +pi (\-pi) is returned.
102 is +0, +0 (\-0) is returned.
106 is a finite value greater (less) than 0, and
108 is negative infinity, +pi (\-pi) is returned.
112 is a finite value greater (less) than 0, and
114 is positive infinity, +0 (\-0) is returned.
118 is positive infinity (negative infinity), and
121 pi/2 (\-pi/2) is returned.
125 is positive infinity (negative infinity) and
127 is negative infinity, +3*pi/4 (\-3*pi/4) is returned.
131 is positive infinity (negative infinity) and
133 is positive infinity, +pi/4 (\-pi/4) is returned.
136 .\" If both arguments are 0, a domain error shall not occur.
139 .\" POSIX.1 documents an optional underflow error
140 .\" glibc 2.8 does not do this.
142 For an explanation of the terms used in this section, see
150 Interface Attribute Value
155 T} Thread safety MT-Safe
161 C99, POSIX.1-2001, POSIX.1-2008.
163 The variant returning