atan(3)
β¨ atan β arc tangent function β¨
okay bestie so you know how tangents are everywhere and sometimes you have the answer and you need to work backwards to the angle? yeah. that's this. this is the atan(3) page from the Library Functions Manual, and it's lowkey one of the most useful little guys in libm π
π¦ LIBRARY
Math library (libm, link it with -lm) β do not forget the -lm, I am literally begging you π
πΈ SYNOPSIS
#include <math.h>
double atan(double x);
float atanf(float x);
long double atanl(long double x);
β¨ Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
atanf(), atanl():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
so if you're on an old glibc and atanf is ghosting you, it's a macro thing, not a you thing π«Ά
π DESCRIPTION
These functions calculate the principal value of the arc tangent of x β which is just a fancy way of saying: the value whose tangent is x. you hand them a tangent, they hand you back the angle. that's the whole job. icon behavior honestly π
π RETURN VALUE
- On success, these functions return the principal value of the arc tangent of
x, in radians π β and the return value lives in the range[-pi/2, pi/2]. - If
xis a NaN, a NaN is returned. (garbage in, garbage out, but make it polite π) - If
xis+0(-0),+0(-0) is returned β yes it preserves the sign, the little overachiever β¨ - If
xis positive infinity (negative infinity),+pi/2(-pi/2) is returned πΈ
π ERRORS
No errors occur. literally none. not a single one. this function has zero drama, we love a stable queen π
π₯ ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
atan(),atanf(),atanl()β Thread safety β MT-Safe π§
(translation: it's thread safe, go wild, run it in every thread you want, it will not start anything π)
β STANDARDS
C11, POSIX.1-2008. certified, stamped, approved π
π¦ HISTORY
- C99, POSIX.1-2001.
- The variant returning
doublealso conforms to SVr4, 4.3BSD, C89 β it's been doing this since basically forever, an actual elder icon π
π SEE ALSO
acos(3), asin(3), atan2(3), carg(3), catan(3), cos(3), sin(3), tan(3)
no cap: if you catch yourself needing the arc tangent of two arguments, that's atan2(3)'s whole thing. go say hi to it π«Ά
and that's the page, bestie!! this was brought to you by Linux man-pages 6.20, dated 2026-02-08, and it's giving atan(3) realness β¨π slay responsibly, and remember: radians, not degrees, or the math girlies will find you π
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 1993, David Metcalfe <david@prism.demon.co.uk>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms