# Ruby - Math.atanh() Method

The Ruby Math.atanh() method returns inverse hyperbolic tangent of a value. The inverse hyperbolic tangent of x is defined as:

### Syntax

```Math.atanh(x)
```

### Parameters

 `x` Specify the value in range [-1, 1].

### Return Value

Returns the inverse hyperbolic tangent of a value.
If the x is not in the range of [-1, 1], DomainError is thrown.
If the x is -1, it returns -Infinity.
If the x is 1, it returns Infinity.

### Example:

In the example below, Math.atanh() method is used to find out the inverse hyperbolic tangent of a value.

```puts "Math.atanh(-1) = #{Math.atanh(-1)}"
puts "Math.atanh(-0.5) = #{Math.atanh(-0.5)}"
puts "Math.atanh(0) = #{Math.atanh(0)}"
puts "Math.atanh(0.5) = #{Math.atanh(0.5)}"
puts "Math.atanh(1) = #{Math.atanh(1)}"
```

The output of the above code will be:

```Math.atanh(-1) = -Infinity
Math.atanh(-0.5) = -0.5493061443340548
Math.atanh(0) = 0.0
Math.atanh(0.5) = 0.5493061443340548
Math.atanh(1) = Infinity
```

❮ Ruby Math Module

5