# Ruby – Find Inverse Hyperbolic Tangent – atanh() Method with Examples

In Ruby, `atanh()` is a method in `CMath` class  of Ruby language. It is used to find the inverse hyperbolic tangent of any given complex number in Ruby programming language

## `atanh()` Method in Ruby

`atanh()` method exists in Standard CMath Library of Ruby. The purpose of this method is to provide perfect inverse hyperbolic tangent of any given complex number.

## Syntax of the `atanh()` Method in Ruby

Syntax of `atanh()` method is:

```cmath.atanh(x)
```

## Parameter of `atanh()` Method in Ruby

 Parameter Description `x` Any valid complex number. This parameter is required.

Note: If the `x` parameter is not a complex number, `atanh()` method will return an `error`.

## Return Value of `atanh()`

`atanh()` method will return the arc tangent of any given complex number.

## Ruby – Get the `atanh()` of Given Numbers

``` # import CMath library
require 'cmath'
x = CMath.atanh(10 + 5i)
puts x
```

Output

` 0.0800418818990673+1.5305608211621662i`

## Ruby `atanh()` Method Example 1

``` # import CMath library
require 'cmath'
x = CMath.atanh(-10 + 5i)
puts x
```

Output

`-0.08004188189906739+1.5305608211621662i`

## Ruby `atanh()` Method Example 2

``` # import CMath library
require 'cmath'
x = CMath.atanh(0 + 0i)
puts x
```

Output

` 0.0+0.0i`

## Ruby `atanh()` Method Example 3

``` # import CMath library
require 'cmath'
x = CMath.atanh(-10)
puts x
```

Output

` -0.10033534773107555+1.5707963267948966i`

## Ruby – Non-Complex Number in `atanh()` Method Produces Error

``` # import CMath library
require 'cmath'
x = CMath.atanh(a10 - b5i)
puts x
```

Output

` Error`