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 x is a NaN, a NaN is returned. (garbage in, garbage out, but make it polite πŸ’€)
  • If x is +0 (-0), +0 (-0) is returned β€” yes it preserves the sign, the little overachiever ✨
  • If x is 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 double also 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms