Home >>C Math Functions >C math tanh() function
The C math double tanh(double x) function is used to return the hyperbolic tangent of any given argument x. It takes a single argument and returns the value in type double. This function is defined in <math.h> header file.
Syntax:double tanh(double x)
x − It is the floating point value.
Here is an example of tanh() function:
#include <stdio.h>
#include <math.h>
int main () {
double x, ret;
x = 0.555;
ret = tanh(x);
printf("The hyperbolic tangent of %lf is %lf degrees", x, ret);
return(0);
}
#include <stdio.h>
#include <math.h>
int main () {
double x, ret;
x = 0.75;
ret = tanh(x);
printf("The hyperbolic tangent of %lf is %lf degrees", x, ret);
return(0);
}