C Standard Libraries C++

tanh()

Declaration

double tanh(double dX);

Description

This function returns the hyperbolic tangent of the passed-in argument.

Overloads

float tanh(float);
double tanh(double);
long double tanh(long double);

Related Functions

float tanhf(float);
long double tanhl(long double);

* Note: Since C does not allow function overloading, these other versions of this function exist.

Domain

(-∞, ∞)

Range

(-1.0, 1.0)

Periodicity

None

Symmetry

Origin

Asymptotes

None





Example

#include <iostream>
#include <cmath>

int main() {
    using namespace std;

    double dX = -0.05;
    cout << "x = " << dX << "  tanh(x) = " << tanh(dX) << endl;

    dX = 1.8;
    cout << "x = " << dX << "  tanh(x) = " << tanh(dX) << endl;

    return 0;
}

Output

tanh() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.