w3resource

C tanh() function

C tanh() function - Calculate hyperbolic tangent

Syntax:

double tanh(double x)

The tanh() function is calculate the hyperbolic tangent of x.

Parameters:

Name Description Required /Optional
x This is the floating point value. Required

Return value from tanh()

  • Returns the value of the hyperbolic tangent of x.

Example: tanh() function

The following example shows the usage of tanh() function.

#include <math.h>
#include <stdio.h>
 
int main(void)
{
   double pi, x, y; 
   pi = 3.1415926535;
   x = pi/2;
   y = tanh(x); 
   printf("tanh( %lf ) = %lf\n", x, y);
} 

Output:

tanh( 1.570796 ) = 0.917152

C Programming Code Editor:

Previous C Programming: C sinh()
Next C Programming: C exp()



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/c-programming/math/c-tanh.php