Acosh()
Published Sep 27, 2023
Contribute to Docs
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
:
Contribute to Docs
- 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.
Learn Go on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Free course
Learn Go
Learn how to use Go (Golang), an open-source programming language supported by Google!Beginner Friendly6 hours