Latest web development tutorials

C library functions - tanh ()

C standard library - <math.h> C standard library - <math.h>

description

C library functionsdouble tanh (double x) Returns the hyperbolic tangent of x.

statement

Here is tanh () function's declaration.

double tanh(double x)

parameter

  • x - floating-point value.

return value

This function returns the hyperbolic tangent of x.

Examples

The following example demonstrates tanh () function is used.

#include <stdio.h>
#include <math.h>

int main ()
{
   double x, ret;
   x = 0.5;

   ret = tanh(x);
   printf("%lf 的双曲正切是 %lf 度", x, ret);
   
   return(0);
}

Let's compile and run the above program, which will result in the following:

0.500000 的双曲正切是 0.462117 度

C standard library - <math.h> C standard library - <math.h>