RAD Studio |  |

tanh, tanhl

Header File

math.h

Category

Math Routines

Prototype

double tanh(double x);

long double tanhl(long double x);

Description

Calculates the hyperbolic tangent.

tanh computes the hyperbolic tangent, sinh(x)/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.

Return Value

tanh and tanhl return the hyperbolic tangent of x.

Example

Copy Code

    #include <stdio.h>
    #include <math.h>
    int main(void)
    {
       double result, x;
       x = 0.5;
       result = tanh(x);
       printf("The hyperbolic tangent of %lf is %lf\n", x, result);
       return 0;
    }

Portability

| POSIX | Win32 | ANSI C | ANSI C++
tanh | + | + | + | +
tanhl |  | + | + | +

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!