Atanh()
function is used to find the inverse hyperbolic tangent for the given input (x
– parameter) in Go language.
The standard math package of Go programming language has Atanh()
function. The purpose of this function is to find the inverse of the hyperbolic tangent function.
Syntax of Atanh()
Function in Go Language
The syntax of
Atanh()
function in Go Language is:
func Atanh(x float64) float64
Note: float64
is a data type in Go language which has IEEE-754 64-bit floating-point numbers.
Special cases are:
Atanh(1) = +Inf
Atanh(±0) = ±0
Atanh(-1) = -Inf
Atanh(x) = NaN if x < -1 or x > 1
Atanh(NaN) = NaN
Parameters of Atanh()
Function in Go Language
x
– Where x
is any Valid float64
Input value. This parameter is required.
Error Handling
If the
If there is no argument (
x
parameter is not a number (numeric value) Atanh()
function returns an error
.If there is no argument (
x
– input value) passes to the function, then the compiler will produce an error
.
Return Value of Atanh()
Function in Go Language
Atanh()
function will returns the inverse hyperbolic tangent of the given input(x
– parameter).
GoLang Atanh()
Function Example 1
pckage main import "fmt" import "math" func main() { var x float64 x = math.Atanh(-1) fmt.Println(x) }
Output:
-Inf
GoLang Atanh()
Function Example 2
package main import "fmt" import "math" func main() { var x float64 x = math.Atanh(0) fmt.Println(x) }
Output:
0
GoLang Atanh()
Function Example 3
package main import "fmt" import "math" func main() { var x float64 x = math.Atanh(8) fmt.Println(x) }
Output:
NaN