catanh(3)
π catanh(3) β the complex arc hyperbolic tangent situation π
okay so bestie, you opened the manual for catanh, and you're in the Library Functions Manual zone, section 3. these are the math girlies β catanh, catanhf, and catanhl β and we're about to get into it. no cap. π
β¨ NAME β¨
catanh, catanhf, catanhl β complex arc tangents hyperbolic π¦
like, the inverse of the hyperbolic tangent, but make it complex. periodt.
π LIBRARY π
Math library (libm, -lm)
bestie. you have to link-lm. i'm not kidding. every single time someone forgets-lma small fairy loses her wings. π§
πΈ SYNOPSIS πΈ
#include <complex.h>
double complex catanh(double complex z);
float complex catanhf(float complex z);
long double complex catanhl(long double complex z);
three flavours, one vibe. pick your precision, queen. π
double complex catanh(double complex z);β the classic, the default, the main characterfloat complex catanhf(float complex z);β thefone, floats, cute and fastlong double complex catanhl(long double complex z);β thelone, max precision, extra
π«Ά DESCRIPTION π«Ά
so these functions calculate the complex arc hyperbolic tangent of z. that's the whole thing. it's giving inverse function energy. β¨
the way that works: if y = catanh(z), then z = ctanh(y). yes bestie, they undo each other. iconic behaviour honestly. π₯
and the imaginary part of y gets chosen in the interval [-pi/2,pi/2]. locked in. that's the branch, no negotiating. π
One has: π
catanh(z) = 0.5 * (clog(1 + z) - clog(1 - z))
that's literally the formula, keep it in your notes. π
π ATTRIBUTES π
if you want the whole explanation of what these terms even mean, go read attributes(7). it's a whole thing. but here's the tea for this one:
- Interface:
catanh(),catanhf(),catanhl() - Attribute: Thread safety
- Value:
MT-Safe
so yeah. thread safe. you can absolutely have your threads in there at the same time, it's fine, breathe. π§
π STANDARDS π
C11, POSIX.1-2008.
she's official. she's standardised. she's certified. β
π HISTORY π
glibc 2.1. and before that, C99, POSIX.1-2001.
a whole legacy. we love a function with lore. π
π EXAMPLES π
okay here's a whole little program, and the comment at the top is IMPORTANT β you link with "-lm". do not skip it. π
/* 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;
if (argc != 3) {
fprintf(stderr, "Usage: %s <real> <imag>\n", argv[0]);
exit(EXIT_FAILURE);
}
z = atof(argv[1]) + atof(argv[2]) * I;
c = catanh(z);
printf("catanh() = %6.3f %6.3f*i\n", creal(c), cimag(c));
f = 0.5 * (clog(1 + z) - clog(1 - z));
printf("formula = %6.3f %6.3f*i\n", creal(f), cimag(f));
exit(EXIT_SUCCESS);
}
what's happening here? you hand it a real part and an imag part as arguments, it builds z out of them, runs catanh(z) and prints it β then it also computes the formula by hand with clog and prints that too, so you can see them match. side by side. it's giving proof. slay. π
and if you don't pass exactly two args? it screams at you with a usage message and bails with EXIT_FAILURE. fair honestly.
π SEE ALSO π
go read those too, bestie, the whole complex family is lowkey fascinating. π¦
and that's the page!! this was Linux man-pages 6.20, dated 2026-02-08, filed under catanh(3). 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