Go 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.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn how to use Go (Golang), an open-source programming language supported by Google!
    • Beginner Friendly.
      6 hours

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

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn how to use Go (Golang), an open-source programming language supported by Google!
    • Beginner Friendly.
      6 hours