| 1 |
'\" t |
| 2 |
.\" Copyright 1993, David Metcalfe <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH tanh 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
tanh, tanhf, tanhl \- hyperbolic tangent function |
| 10 |
.SH LIBRARY |
| 11 |
Math library |
| 12 |
.RI ( libm ,\~ \-lm ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <math.h> |
| 16 |
.P |
| 17 |
.BI "double tanh(double " x ); |
| 18 |
.BI "float tanhf(float " x ); |
| 19 |
.BI "long double tanhl(long double " x ); |
| 20 |
.fi |
| 21 |
.P |
| 22 |
.RS -4 |
| 23 |
Feature Test Macro Requirements for glibc (see |
| 24 |
.BR feature_test_macros (7)): |
| 25 |
.RE |
| 26 |
.P |
| 27 |
.BR tanhf (), |
| 28 |
.BR tanhl (): |
| 29 |
.nf |
| 30 |
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
| 31 |
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE |
| 32 |
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE |
| 33 |
.fi |
| 34 |
.SH DESCRIPTION |
| 35 |
These functions return the hyperbolic tangent of |
| 36 |
.IR x , |
| 37 |
which |
| 38 |
is defined mathematically as: |
| 39 |
.P |
| 40 |
.nf |
| 41 |
tanh(x) = sinh(x) / cosh(x) |
| 42 |
.fi |
| 43 |
.SH RETURN VALUE |
| 44 |
On success, these functions return the hyperbolic tangent of |
| 45 |
.IR x . |
| 46 |
.P |
| 47 |
If |
| 48 |
.I x |
| 49 |
is a NaN, a NaN is returned. |
| 50 |
.P |
| 51 |
If |
| 52 |
.I x |
| 53 |
is +0 (\-0), +0 (\-0) is returned. |
| 54 |
.P |
| 55 |
If |
| 56 |
.I x |
| 57 |
is positive infinity (negative infinity), |
| 58 |
+1 (\-1) is returned. |
| 59 |
.\" |
| 60 |
.\" POSIX.1-2001 documents an optional range error (underflow) |
| 61 |
.\" for subnormal x; |
| 62 |
.\" glibc 2.8 does not do this. |
| 63 |
.SH ERRORS |
| 64 |
No errors occur. |
| 65 |
.SH ATTRIBUTES |
| 66 |
For an explanation of the terms used in this section, see |
| 67 |
.BR attributes (7). |
| 68 |
.TS |
| 69 |
allbox; |
| 70 |
lbx lb lb |
| 71 |
l l l. |
| 72 |
Interface Attribute Value |
| 73 |
T{ |
| 74 |
.na |
| 75 |
.nh |
| 76 |
.BR tanh (), |
| 77 |
.BR tanhf (), |
| 78 |
.BR tanhl () |
| 79 |
T} Thread safety MT-Safe |
| 80 |
.TE |
| 81 |
.SH STANDARDS |
| 82 |
C11, POSIX.1-2008. |
| 83 |
.SH HISTORY |
| 84 |
C99, POSIX.1-2001. |
| 85 |
.P |
| 86 |
The variant returning |
| 87 |
.I double |
| 88 |
also conforms to |
| 89 |
SVr4, 4.3BSD, C89. |
| 90 |
.SH SEE ALSO |
| 91 |
.BR acosh (3), |
| 92 |
.BR asinh (3), |
| 93 |
.BR atanh (3), |
| 94 |
.BR cosh (3), |
| 95 |
.BR ctanh (3), |
| 96 |
.BR sinh (3) |