tanh -- Compute the Hyperbolic Tangent

SYNOPSIS

 #include <math.h>

 double tanh(double x);
 

DESCRIPTION

tanh computes the hyperbolic tangent of its argument x, as expressed by this relation:
 r = (e**x - e**-x) / (e**x + e**-x)
 

RETURN VALUE

tanh returns the principal value of the hyperbolic tangent of the argument x, provided that this value is defined and computable. The return value is a double-precision, floating-point number in the closed interval [ - 1.0,1.0].

DIAGNOSTICS

If an error occurs in tanh, the _matherr routine is called. You can supply your own version of _matherr to suppress the diagnostic message or modify the value returned.

EXAMPLE

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

  #define INVAL 3.8

  main()
  {
     double hyper_tan;
     hyper_tan = tanh(INVAL);
     printf("tanh(%f) = %fn", INVAL, hyper_tan);
  }

 

RELATED FUNCTIONS

cosh, _matherr, sinh

SEE ALSO

Mathematical Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.