Acosh()
The Acosh()
function returns the inverse hyperbolic cosine of a number.
Syntax
result := math.Acosh(number)
The Acosh()
function takes one parameter, number
, of type float64
. And the method also returns a float64
. This value represents the inverse hyperbolic cosine, or arccosh, of number
. It’s important to note that the returned value is in radians. If the value of number
is:
- Not defined (
undefined
), then it returnsNaN
(Not a Number) - Less than
1
, including negative infinity (-Inf
) or equivalent, then it returnsNaN
- Greater than or equal to
1
, including positive infinity (+Inf
) or equivalent, then it returns+Inf
Note: The
math
library must be imported first to use this function.
Example
The following example first calculates the inverse hyperbolic cosine of num
and then prints out the result to the console:
package mainimport ("fmt""math")func main() {num := 16.0inverseHyperbolicCosine := math.Acosh(num)fmt.Printf("The inverse hyperbolic cosine of %f is %f\n", num, inverseHyperbolicCosine)}
The output will be:
The inverse hyperbolic cosine of 16.000000 is 3.464758
Codebyte Example
The following example is runnable and uses the Acosh()
function with two values: positive infinity and 0.5
:
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.