C <math.h> - tanh() Function
The C <math.h> tanh() function returns hyperbolic tangent of a value. The hyperbolic tangent of x is defined as:
where e is an Euler's number.
Syntax
double tanh (double x); float tanhf (float x); long double tanhl (long double x);
Parameters
x |
Specify the value. |
Return Value
Returns the hyperbolic tangent of a value.
Example:
In the example below, tanh() function is used to find out the hyperbolic tangent of a value.
#include <stdio.h> #include <math.h> int main (){ printf("%lf\n", tanh(0)); printf("%lf\n", tanh(2)); printf("%lf\n", tanh(4)); return 0; }
The output of the above code will be:
0.000000 0.964028 0.999329
❮ C <math.h> Library