C tanh() function

C tanh() function - Calculate hyperbolic tangent


double tanh(double x)

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


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);


tanh( 1.570796 ) = 0.917152

C Programming Code Editor:

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

Follow us on Facebook and Twitter for latest update.