The Atanh
function in the Go programming language is used to find the inverse hyperbolic tangent value passed to it as input.
To use the Atanh
function, you must import the math
package in your file and access the Atanh
function within it using the .
notation (math.Atanh
). Here, Atanh
is the actual function, while math
is the Go package that stores the definition of this function.
The definition of the Atanh
function inside the math
package is shown below:
The Atanh
function takes a single argument of type float64
that represents the angle whose inverse hyperbolic tangent value you want to find.
The Atanh
function returns a single value of type float64
that represents the inverse hyperbolic tangent value of the argument. The possible range of all return values is between negative infinity and positive infinity.
An exception to the above statements is when you pass something that is less than -1, greater than +1, or
NAN
as an argument. In these cases, theAtanh
function returnsNAN
.
Below is a simple example in which we use the Atan
function to find the inverse hyperbolic tangent value of 0.5:
package mainimport "fmt"import "math"func main() {x := math.Atanh(0.5)fmt.Println(x)}
The following example shows how passing NAN
as an argument makes the Atanh
function return NAN
:
package mainimport "fmt"import "math"func main() {x := math.Atanh(1.5)fmt.Println(x)}