C tanh function returns the hyperbolic tangent of arg
Syntax
C tanh function has the following syntax.
float tanhf(float arg);
double tanh(double arg);
long double tanhl(long double arg);
Header
C tanh functions are from header file math.h
.
Description
C tanh functions return the hyperbolic tangent of arg.
Example
The following code uses C tanh function to calculate the hyperbolic tangent of arg.
#include <math.h>
#include <stdio.h>
// w w w. j av a 2 s . c om
int main(void)
{
double val = -1.0;
do {
printf("Hyperbolic tangent of %f is %f.\n", val, tanh(val));
val += 0.1;
} while(val<=1.0);
return 0;
}
The code above generates the following result.