acos(3)

✨ acos β€” arc cosine function πŸ’œ

okay bestie, so like, this is the manual page for acos, acosf, and acosl from the Linux man-pages collection (that's the manual section 3, library functions, iykyk). Sit down, grab a lil snack πŸ“, and let's get into it.


πŸŽ€ NAME

acos, acosf, acosl β€” the arc cosine function, aka the math girlies who go backwards from a cosine value and hand you the angle. iconic behaviour fr.


πŸ“š LIBRARY

Math library, aka libm, which you link with -lm β€” and no cap, if you forget the -lm you're gonna have a bad time. 🫢


🌸 SYNOPSIS

#include <math.h>

double acos(double x);
float acosf(float x);
long double acosl(long double x);

Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

acosf(), acosl():

_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
    || /* Since glibc 2.19: */ _DEFAULT_SOURCE
    || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
πŸ’€ yes bestie, the feature test macros are giving "final boss of build system errors". Copy them exactly, don't freestyle.

🌈 DESCRIPTION

These functions calculate the arc cosine of x. Which is a fancy way of saying: they hand you back the value whose cosine is x. It's the reverse-girlie of cos(). πŸ’…


⭐ RETURN VALUE

On success β€” the glow-up moment β€” these functions return the arc cosine of x in radians, and that return value lives in the range [0, pi]. So it's never gonna go rogue on you. 🌸

  • If x is a NaN, a NaN is returned.
  • If x is +1, +0 is returned.
  • If x is positive infinity or negative infinity, a domain error occurs, and a NaN is returned. πŸ’€
  • If x is outside the range [-1, 1], a domain error occurs, and a NaN is returned.

πŸ”₯ ERRORS

Peep math_error(7) if you wanna know how to figure out whether an error went down while you were calling these functions. Detective work, but make it C. 🧚

The following errors can occur:

  • Domain error: x is outside the range [-1, 1] β€” errno is set to EDOM, and an invalid floating-point exception (FE_INVALID) is raised.
😭 literally the second you step outside [-1, 1] the function says "not me, not today". Respect the domain bestie.

πŸ‘‘ ATTRIBUTES

For an explanation of the terms used in this section, see attributes(7).

  • Interface: acos(), acosf(), acosl()
  • Attribute: Thread safety
  • Value: MT-Safe
so yeah, all three of them are MT-Safe, which is the good one. go off. ✨

πŸ’– STANDARDS

C11, POSIX.1-2008.


πŸ¦‹ HISTORY

C99, POSIX.1-2001.

The variant returning double also conforms to C89, SVr4, 4.3BSD. She's been around. She's a legend. She's been serving since before your parents had a landline. πŸ‘‘


🌟 SEE ALSO

asin(3), atan(3), atan2(3), cacos(3), cos(3), sin(3), tan(3)


and that's the whole vibe check bestie πŸŽ€ this page is from Linux man-pages 6.20, dated 2026-02-08. slay, go compute some angles, and don't forget -lm πŸ’…βœ¨

πŸ“¦ 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