function
<cmath> <ctgmath>
tanh
double tanh (double x);
float tanhf (float x);
long double tanhl (long double x);
double tanh (double x);
float tanh (float x);
long double tanh (long double x);
double tanh (T x); // additional overloads for integral types
Compute hyperbolic tangent
Returns the hyperbolic tangent of x radians.
Header
<tgmath.h> provides a type-generic macro version of this function.
Parameters
- x
- Value representing an angle, expressed in radians.
Return Value
Hyperbolic tangent of x.
Example
1 2 3 4 5 6 7 8 9 10 11 12
|
/* tanh example */
#include <stdio.h> /* printf */
#include <math.h> /* tanh, log */
int main ()
{
double param, result;
param = log(2.0);
result = tanh (param);
printf ("The hyperbolic tangent of %f is %f.\n", param, result);
return 0;
}
|
Output:
The hyperbolic tangent of 0.693147 is 0.600000.
|
See also
- sinh
- Compute hyperbolic sine (function
)
- cosh
- Compute hyperbolic cosine (function
)