Javatpoint Logo
Javatpoint Logo

C++ Math tanh()

The function computes the hyperbolic tangent of an angle given in radian.

Mathematically,

tanhx = ex -e-x/ ex+e-x

Syntax

Suppose the angle is 'x':

Parameter

x: The value whose hyperbolic tangent is to be computed.

Return value

It returns the hyperbolic tangent of x.

Example 1

Let's see the simple example when the value of x is integer type.

Output:

Value of degree is : 60
tanh(x) : 0.780507   

In this example, tanh(x) function computes the hyperbolic tangent of x and returns the value 0.78.

Example 2

Let's see the simple example when the value of x is float type.

Output:

Value of degree is : 45.2
tanh(x) : 0.657552   

In this example, tanh(x) function computes the hyperbolic tangent of x and returns the value 0.65.


Next TopicC++ Math Functions




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA