Easy Tutorial
❮ Python Os Path Python File Writelines ❯

Python math.tanh() Method

Python math Module

Python math.tanh(x) returns the hyperbolic tangent of x.

Python Version: 1.4

Syntax

The syntax for the math.tanh() method is as follows:

math.tanh(x)

Parameter:

Return Value

Returns a float representing the hyperbolic tangent of a number.

Example

The following example returns the hyperbolic tangent of different numbers:

Example

# Import math package
import math

# Output hyperbolic tangent values
print(math.tanh(8))
print(math.tanh(1))
print(math.tanh(-6.2))

Output result:

0.9999997749296758
0.7615941559557649
-0.9999917628565104

Python math Module

❮ Python Os Path Python File Writelines ❯