Menu Close

Go – How to get the inverse hyperbolic cosine of number

Here, We will learn how to get the inverse hyperbolic cosine of number in go. We can get it by using Acosh() function in math package in go golang.

Function prototype:

func Acosh(x float64) float64

Return value:

Acosh returns the inverse hyperbolic 
cosine of number.

Example with code:

package main

import (
  "fmt"
  "math"
)

func main() {
   no := math.Acosh(1)
  fmt.Printf("%.2f\n", no)
	
  no = math.Acosh(2)
  fmt.Printf("%.2f\n", no)
	
  no = math.Acosh(0.75)
  fmt.Printf("%.2f\n", no)
}

Output:

0.00
1.32
NaN

To learn more about golang, Please refer given below link:

https://www.techieindoor.com/go-lang-tutorial/

References:

https://golang.org/doc/
https://golang.org/pkg/
Posted in golang, math

Leave a Reply

Your email address will not be published. Required fields are marked *