C++ cmath tanh() function
Example
Return the hyperbolic tangent of different numbers:
cout << tanh(3);
cout << tanh(-3);
cout << tanh(0);
cout << tanh(1);
Try it Yourself »
Definition and Usage
The tanh()
function returns the hyperbolic tangent of a number. The hyperbolic tangent is equivalent to sinh(number) / cosh(number)
.
The tanh()
function is defined in the <cmath>
header file.
Syntax
One of the following:
tanh(double number);
tanh(float number);
Parameter Values
Parameter | Description |
---|---|
number | Required. Specifies a number. If the number is an integer type then it will be treated as a double . |
Technical Details
Returns: | A float value (if the argument is float) or double value (in any other case) representing the hyperbolic tangent of a number. |
---|