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;
}
While using gcc use below command to add math header.
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.
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);
tanh( ) | tan( ) |
Used to find hyperbolic tangent of given number. | Used to find tangent of a given number. |
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);
tanh( ) | sinh( ) |
Used to find hyperbolic tangent of given number. | Used to find hyperbolic sine of given number. |
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);
tanh( ) | cosh( ) |
Used to find hyperbolic tangent of given number. | Used to find hyperbolic cosine of given number. |
double tanh(double y); | double cosh(double y); |
People also ask for
What does tanh mean in c?
tanh in c is a mathematical function that is used to calculate the hyperbolic tangent of a given number.
What is the range of tanh?
tanh range is -1 to 1. This function is defined in math.h header file.