tanh(3)
π tanh(3) β hyperbolic tangent, bestie edition π
okay so this is a page from the Library Functions Manual (section 3, the "library calls" girlies), and it's all about tanh and her two glow-up siblings tanhf and tanhl. buckle up, this one is short but she's iconic π
β¨ NAME β¨
tanh, tanhf, tanhl β the hyperbolic tangent function π¦
π LIBRARY π
Math library, aka libm, and you link her with -lm (yes bestie, you have to pass the flag, she's not coming for free) β¨
πΈ SYNOPSIS πΈ
#include <math.h>
double tanh(double x);
float tanhf(float x);
long double tanhl(long double x);
π§ Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
for tanhf() and tanhl():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
like, define one of those or the compiler is gonna act brand new, no cap π
π DESCRIPTION π
These functions hand you back the hyperbolic tangent of x, and mathematically she is defined as:
tanh(x) = sinh(x) / cosh(x)
that's the whole vibe. sinh over cosh. girl math? no. real math π
π RETURN VALUE π
On success, these functions return the hyperbolic tangent of x. periodt.
- If
xis aNaN, aNaNis returned. (garbage in, garbage out, she's not gonna lie to you π) - If
xis+0(-0),+0(-0) is returned. signed zero stays signed, she remembers π€ - If
xis positive infinity (negative infinity),+1(-1) is returned. she saturates, she's chill like that π₯
π ERRORS π
No errors occur. not a single one. she simply does not miss. π
π ATTRIBUTES π
For an explanation of the terms used in this section, see attributes(7).
- Interface:
tanh(),tanhf(),tanhl() - Attribute: Thread safety
- Value:
MT-Safe
translation: she's MT-Safe, so go off, call her from all your threads, she's not gonna start drama π«Ά
β STANDARDS β
C11, POSIX.1-2008. she's certified, she's official, she passed the vibe check π
π°οΈ HISTORY π°οΈ
C99, POSIX.1-2001. been that girl since the late 90s fr fr.
The variant returning double also conforms to SVr4, 4.3BSD, C89. so basically the double version has been around forever, a true elder icon πΈ
π¦ SEE ALSO π¦
acosh(3), asinh(3), atanh(3), cosh(3), ctanh(3), sinh(3)
the whole hyperbolic friend group!! go say hi, they're all obsessed with each other π«Άβ¨
and that's the tea, bestie π this was pulled from Linux man-pages 6.20, dated 2026-02-08 β so you know it's fresh, it's current, and it ate. 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: 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