 tanh in c programming

## What is tanh in c programming?

tanh in c is a mathematical function which is used to calculate hyperbolic tangent of a given number.

This function is defined in math.h header file.

### Prototype of tanh in c

``double tanh(double m);``

### Parameters

tanh function takes floating point value as input parameter.

### Return value

tanh function returns hyperbolic tangent value of a given number.

## Example program for tanh in c

``````#include<stdio.h>
#include<math.h>
int main()
{
double m=0.9,res;
res=tanh(m);
printf("Hyperbolic tangent value is %lf \n",res);
return 0;
}``````

``gcc file_name.c -lm``

### Code explanation

The hyperbolic tangent value of a given number is found by calling the tanh function. The result is being printed onto the console.

tanh() Man page

## Difference between tanh and tan in c

tanh in c is used to find the hyperbolic tangent of a given number. tan in c is a mathematical function that is used to find the tangent of a given number.

Prototypes are as follows

``````double tanh(double y);

double tan(double y);``````

## Difference between tanh and sinh in c

tanh in c is used to find the hyperbolic tangent of a given number. sinh in c is used to find the hyperbolic sine of a given number.

Prototypes are as follows

``````double tanh(double y);

double sinh(double y);``````

## Difference between tanh and cosh in c

tanh in c is used to find the hyperbolic tangent of a given number. cosh in c is used to find the hyperbolic cosine of a given number.

Prototypes are as follows

``````double tanh(double y);

double cosh(double y);``````