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
xis aNaN, aNaNis returned. - If
xis+1,+0is returned. - If
xis positive infinity or negative infinity, a domain error occurs, and aNaNis returned. π - If
xis outside the range[-1, 1], a domain error occurs, and aNaNis 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:
xis outside the range[-1, 1]βerrnois set toEDOM, 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
- 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