C tanh function returns the hyperbolic tangent of arg

Syntax

C tanh function has the following syntax.

  • float tanhf(float arg);
  • double tanh(double arg);
  • long double tanhl(long double arg);

C tanh functions are from header file math.h.

Description

C tanh functions return the hyperbolic tangent of arg.

Example

The following code uses C tanh function to calculate the hyperbolic tangent of arg.


#include <math.h>
#include <stdio.h>
//  w w w.  j  av  a  2 s  .  c om
int main(void)
{
  double val = -1.0;

  do {
    printf("Hyperbolic tangent of %f is %f.\n", val, tanh(val));
    val += 0.1;
  } while(val<=1.0);

  return 0;
}

The code above generates the following result.





















Home »
  C Language »
    Function Reference »




assert.h
ctype.h
math.h
setjmp.h
signal.h
stdio.h
stdlib.h
string.h
time.h
wctype.h