Borland C++ reference

tanh, tanhl

raw OCR

Calculates the hyperbolic tangent. Real versions: Complex version:

Defined in header <math.h>

Syntax

#include <math.h>                #include <complex.h>
double tanh(double x);           complex  tanh(complex x);
long double tanhl(long double x);

Portability

DOSUNIXWindowsANSI CC++ only
tanhl ■■
Real tanh ■■■■
Complex tanh ■■■

Remarks

tanh computes the hyperbolic tangent, sinh(j)/cosh(x).

tanhl is the long double version; it takes a long double argument and returns a long double result.

Error handling for these functions can be modified through the functions matherr and _matherrl.

The complex hyperbolic tangent is defined by

tanh(z) = sinh(z) / cosh(z)

Return value

tanh and tanhl return the hyperbolic tangent of x.

See also

Example

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

int main(void)
{
   double result, x    1.5;
   result = tanh(x);
   printfC'The hyperbolic tangent of %lf is %lf\n", x, result);
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.