cacos(3)
π cacos(3) β bestie's guide to the complex arc cosine π
okay so picture this: you're deep in <complex.h> land, you need the arc cosine of a complex number, and you open the man page. that's this page. welcome. come sit with me. πΈ
this is the Library Functions Manual entry for cacos, and it's giving very much "math girlies rise up" energy. three flavors, one vibe. let's go. β¨
π LIBRARY
this lives in the Math library, aka libm, and yeah you're gonna need to link it with -lm. no cap.
π SYNOPSIS
#include <complex.h>
double complex cacos(double complex z);
float complex cacosf(float complex z);
long double complex cacosl(long double complex z);
three functions, three precisions, all eating the same snack. π
π¦ DESCRIPTION
okay so these functions calculate the complex arc cosine of z. so simple, so clean.
here's the deal, fr fr: if y = cacos(z), then z = ccos(y). they're inverse besties. the way that works is chef's kiss. π«Ά
and the real part of y is chosen in the interval [0,pi]. that's the rules, periodt.
also, one has:
cacos(z) = -i * clog(z + i * csqrt(1 - z * z))
which is honestly iconic. write it on your mirror. π
π ATTRIBUTES
so there's this thing called attributes(7) and it explains all the terms used in this section β go read it if you want the lore. here's the tea for our three functions:
cacos(),cacosf(),cacosl()- Attribute: Thread safety
- Value:
MT-Safe
meaning: thread safe. run it everywhere. she's built different. π₯
π STANDARDS
C11POSIX.1-2008
that's it. standards, slayed. β
π°οΈ HISTORY
- glibc 2.1 β the glow up era
C99,POSIX.1-2001β the origin story
ngl, she's been around a minute. π
π§ EXAMPLES
okay bestie, here's the whole demo. do NOT forget to link with "-lm" or nothing works and you'll be sad. π
/* Link with "-lm" */
#include <complex.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int
main(int argc, char *argv[])
{
double complex z, c, f;
double complex i = I;
if (argc != 3) {
fprintf(stderr, "Usage: %s <real> <imag>\n", argv[0]);
exit(EXIT_FAILURE);
}
z = atof(argv[1]) + atof(argv[2]) * I;
c = cacos(z);
printf("cacos() = %6.3f %6.3f*i\n", creal(c), cimag(c));
f = -i * clog(z + i * csqrt(1 - z * z));
printf("formula = %6.3f %6.3f*i\n", creal(f), cimag(f));
exit(EXIT_SUCCESS);
}
so it takes <real> and <imag> as args, builds the complex number z, runs cacos(z), prints it, then also computes it with that formula from up top and prints that too β so you can literally watch them match in real time. main character energy. π
heads up: ifargc != 3it yells at you with the usage line and bails withexit(EXIT_FAILURE). feed it two numbers or don't bother. π
π SEE ALSO
go read those, they're all in the same friend group. π
and that's the whole page, bestie!! π₯° this was written by the Linux man-pages 6.20 girlies and dated 2026-02-08. wash your hands, link with -lm, and go compute something beautiful. mwah. π
β¨π
π¦ 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: GPL-1.0-or-later
- Copyright 2002, Walter Harms <walter.harms@informatik.uni-oldenburg.de>
- Copyright 2011, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms