carg(3)
β¨ carg(3) β¨
okay bestie, welcome to the Linux Library Functions Manual π you're here for carg, cargf, and cargl, and honestly? they're about to eat. no cap.
πΈ NAME πΈ
carg, cargf, cargl β calculate the complex argument π
π LIBRARY π
Math library (libm, -lm)
like, link it, obviously. -lm. don't forget. iykyk. π«Ά
β¨ SYNOPSIS β¨
#include <complex.h>
double carg(double complex z);
float cargf(float complex z);
long double cargl(long double complex z);
three of them. one for each size of dramatic. double, float, long double. slay. π
π¦ DESCRIPTION π¦
so these functions calculate the complex argument of z β which, pro tip, is also called the phase angle β and there's a branch cut along the negative real axis, which is the drama of it all. π
here's the vibe: a complex number can be described by two real coordinates, and you can pick your flavor.
flavor one: rectangular coordinates π and you get
z = x + I * y
where x = creal(z) and y = cimag(z).
flavor two: polar coordinates π and you get
z = r * cexp(I * a)
where r = cabs(z) is the "radius", the "modulus", literally the absolute value of z β and a = carg(z) is the "phase angle", the argument of z. it's giving main character energy for real. π
and the way that these two relate?? π«£
tan(carg(z)) = cimag(z) / creal(z)
periodt. π
π RETURN VALUE π
the return value is in the range of [-pi,pi]. that's it, that's the tea. β not me being precise about it.
β ATTRIBUTES β
for an explanation of the terms used in this section, go look at attributes(7) β it's like the group chat glossary bestie, very helpful.
the girls are thread safe, no notes:
carg(),cargf(),cargl()β Thread safety: MT-Safe π₯
π STANDARDS π
C11, POSIX.1-2008.
certified. iconic. π
π HISTORY π
glibc 2.1.C99,POSIX.1-2001.
so it's been around forever, a true veteran, a legend lowkey. π
π§ SEE ALSO π§
go read the friends, they're part of the same little universe bestie. π¦
k that's the whole page, go forth and compute your phase angles, i'm obsessed with you fr fr π
Linux man-pages 6.20 Β· 2026-02-08 β okay so that's the version and the date, clocked, timestamped, and it's giving official. bye bestie, love you, drink water! πβ¨π«Ά
π¦ 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>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms