atanh(3)

✨ atanh(3) ✨

okay bestie, pull up a chair πŸͺ‘ because we're talking about atanh, atanhf, and atanhl β€” the inverse hyperbolic tangent girlies. they live in section 3 of the Library Functions Manual and they are genuinely so good at what they do. no cap. πŸ’…


🌸 NAME 🌸

atanh, atanhf, atanhl β€” inverse hyperbolic tangent function ✨


πŸ“š LIBRARY πŸ“š

Math library (libm, link it with -lm) 🧚


πŸŽ€ SYNOPSIS πŸŽ€

like literally just include the header and you're set:

#include <math.h>

double atanh(double x);
float atanhf(float x);
long double atanhl(long double x);

πŸ¦‹ Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

bestie, glibc is picky about when it lets you have these. here's the whole vibe check:

atanh():

_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
    || _XOPEN_SOURCE >= 500
    || /* Since glibc 2.19: */ _DEFAULT_SOURCE
    || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

atanhf(), atanhl():

_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
    || /* Since glibc 2.19: */ _DEFAULT_SOURCE
    || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE

πŸ’– DESCRIPTION πŸ’–

these functions calculate the inverse hyperbolic tangent of x πŸ’« β€” meaning they hand you back the value whose hyperbolic tangent is x. it's giving reverse-engineering, it's giving un-tanhing. iconic.


πŸ”₯ RETURN VALUE πŸ”₯

when everything goes right, these functions return the inverse hyperbolic tangent of x. slay.

  • if x is a NaN, a NaN is returned. πŸ’€
  • if x is +0 (-0), +0 (-0) is returned. 🫢
  • if x is +1 or -1, a pole error occurs, and the functions return HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively, with the mathematically correct sign. 😭 (that's a real big number bestie, brace yourself)
  • if the absolute value of x is greater than 1, a domain error occurs, and a NaN is returned. πŸ™ˆ

⚠️ ERRORS ⚠️

go read math_error(7) for the whole lore on how to figure out whether an error even happened when you called these functions. iykyk.

these are the errors that can pop up:

  • Domain error: x less than -1 or greater than +1 β€” errno is set to EDOM. an invalid floating-point exception (FE_INVALID) is raised. 🚨
  • Pole error: x is +1 or -1 β€” errno is set to ERANGE (but see BUGS below, it's a whole thing). a divide-by-zero floating-point exception (FE_DIVBYZERO) is raised. πŸ’₯

πŸ‘‘ ATTRIBUTES πŸ‘‘

for what all these fancy terms even mean, check attributes(7) β€” it's required reading fr fr.

  • Interface: atanh(), atanhf(), atanhl()
    • Attribute: Thread safety
    • Value: MT-Safe βœ…

🌈 STANDARDS 🌈

C11, POSIX.1-2008. periodt. πŸ’…


πŸ•°οΈ HISTORY πŸ•°οΈ

C99, POSIX.1-2001.

the variant returning double also conforms to SVr4, 4.3BSD. a well-traveled legend honestly. ⭐


πŸ’€ BUGS πŸ’€

in glibc 2.9 and earlier, when a pole error occurs, errno is set to EDOM instead of the POSIX-mandated ERANGE. that's a not it moment. since glibc 2.10, glibc does the right thing. we love growth. 🌱


🫢 SEE ALSO 🫢


and that's the whole page bestie!! this one is from Linux man-pages 6.20, dated 2026-02-08, and it belongs to atanh(3). go forth and invert those hyperbolics πŸ’–βœ¨πŸŽ€

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