Easy Tutorial
❮ C Exercise Example99 C Function Getenv ❯

C Library Function - tanh()

C Standard Library - <math.h>

Description

The C library function double tanh(double x) returns the hyperbolic tangent of x.

Declaration

Below is the declaration for the tanh() function.

double tanh(double x)

Parameters

Return Value

This function returns the hyperbolic tangent of x.

Example

The following example demonstrates the use of the tanh() function.

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

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

   ret = tanh(x);
   printf("The hyperbolic tangent of %lf is %lf degrees", x, ret);

   return(0);
}

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

The hyperbolic tangent of 0.500000 is 0.462117 degrees

C Standard Library - <math.h>

❮ C Exercise Example99 C Function Getenv ❯