Popular Tutorials
Start Learning CCertification Courses
Created with over a decade of experience and thousands of feedback.
Python online compiler
JavaScript online compiler
SQL online compiler
Java online compiler
HTML online compiler
C online compiler
C++ online compiler
C# online compiler
PHP online compiler
Swift online compiler
Kotlin online compiler
TypeScript online compiler
Go online compiler
Rust online compiler
Scala online compiler
Dart online compiler
R online compiler
Ruby online compiler
C tanh()
The tanh() function computes the hyperbolic tangent of an argument.
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?