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?

Your builder path starts here. Builders don't just know how to code, they create solutions that matter.

Escape tutorial hell and ship real projects.

Try Programiz PRO
  • Real-World Projects
  • On-Demand Learning
  • AI Mentor
  • Builder Community