Atanh()

DanielLarrazabal's avatar
Published Oct 21, 2023
Contribute to Docs

The Atanh() function takes a float64 argument representing the angle whose inverse hyperbolic tangent value is to be returned. It returns this inverse hyperbolic tangent as a float64 value that can range from negative infinity to positive infinity.

Syntax

result := math.Atanh(x)

Where x represents the angle whose inverse hyperbolic tangent value is to be returned, and result is the inverse hyperbolic tangent of x. Some special exceptions include:

  • Atanh(-1) equals -Inf
  • Atanh(1) equals +Inf

Example

The following code calculates the arctangent and prints out the result:

package main
import (
"fmt"
"math"
)
func main() {
fmt.Println(math.Atanh(0.5))
fmt.Println(math.Atanh(math.NaN()))
}

The output will be:

0.5493061443340548
NaN

All contributors

Contribute to Docs

Learn Go on Codecademy