Calculates the hyperbolic tangent function of a single precision floating-point value.
Include
<math.h>
Prototype
float tanhf(float x);
Argument
x
Return Value
Returns the hyperbolic tangent of x
in the ranges of -1 to
1 inclusive.
Remarks
No domain or range error will occur.
Example
#include <math.h>
#include <stdio.h>
int main(void)
{
float x, y;
x = -1.0F;
y = tanhf(x);
printf("The hyperbolic tangent of %f is %f\n", x, y);
x = 0.0F;
y = tanhf(x);
printf("The hyperbolic tangent of %f is %f\n", x, y);
}
Example Output
The hyperbolic tangent of -1.000000 is -0.761594
The hyperbolic tangent of 0.000000 is 0.000000