C tanh()

C tanh() Prototype

double tanh( double arg );

The tanh() function takes a single argument and returns the value in type double.

It is defined in <math.h> header file.

[Mathematics] tanhx = tanh(x) [In C programming]

In order to find the tanh() of long double or float, you can use the following prototype.

long double tanhl( long double arg);
float tanhf( float arg);

C tanh() range

The arguments passed to the function tanh() can be any number, either negative or positive.

Example: C tanh() function

#include <stdio.h>
#include <math.h>
#define PI 3.141592654

int main()
{
    double angle = 0.40, result;
    result = tanh(angle);
    printf("Tangent hyperbolic of %.2lf (in radians) = %.2lf", angle, result);
    return 0;
}

Output

Tangent hyperbolic of 0.40 (in radians) = 0.38
Did you find this article helpful?