2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <mtk.manpages@gmail.com>
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
8 .\" References consulted:
9 .\" Linux libc source code
10 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
12 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
13 .\" Modified 2002-07-27 by Walter Harms
14 .\" (walter.harms@informatik.uni-oldenburg.de)
16 .TH atan2 3 (date) "Linux man-pages (unreleased)"
18 atan2, atan2f, atan2l \- arc tangent function of two variables
21 .RI ( libm ", " \-lm )
26 .BI "double atan2(double " y ", double " x );
27 .BI "float atan2f(float " y ", float " x );
28 .BI "long double atan2l(long double " y ", long double " x );
32 Feature Test Macro Requirements for glibc (see
33 .BR feature_test_macros (7)):
39 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
40 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
41 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
44 These functions calculate the principal value of the arc tangent of
46 using the signs of the two arguments to determine
47 the quadrant of the result.
49 On success, these functions return the principal value of the arc tangent of
51 in radians; the return value is in the range [\-pi,\ pi].
57 is less than 0, +pi (\-pi) is returned.
63 is greater than 0, +0 (\-0) is returned.
69 is +0 or \-0, \-pi/2 is returned.
75 is +0 or \-0, pi/2 is returned.
80 .\" is 0, a pole error shall not occur.
86 is NaN, a NaN is returned.
89 .\" If the result underflows, a range error may occur and
91 .\" should be returned.
97 is \-0, +pi (\-pi) is returned.
103 is +0, +0 (\-0) is returned.
107 is a finite value greater (less) than 0, and
109 is negative infinity, +pi (\-pi) is returned.
113 is a finite value greater (less) than 0, and
115 is positive infinity, +0 (\-0) is returned.
119 is positive infinity (negative infinity), and
122 pi/2 (\-pi/2) is returned.
126 is positive infinity (negative infinity) and
128 is negative infinity, +3*pi/4 (\-3*pi/4) is returned.
132 is positive infinity (negative infinity) and
134 is positive infinity, +pi/4 (\-pi/4) is returned.
137 .\" If both arguments are 0, a domain error shall not occur.
140 .\" POSIX.1 documents an optional underflow error
141 .\" glibc 2.8 does not do this.
143 For an explanation of the terms used in this section, see
149 Interface Attribute Value
156 T} Thread safety MT-Safe
163 The variant returning