Here, We will learn how to get the hyperbolic tangent of number in go. We can get it by using Tanh() function in math package in go golang.
Function prototype:
func Tanh(x float64) float64
Return value:
Tanh() function in math package returns
the hyperbolic tangent of number.
Example with code:
package main
import (
"fmt"
"math"
)
func main() {
no := math.Tanh(1.2)
fmt.Println(no)
no = math.Tanh(-2.7)
fmt.Println(no)
no = math.Tanh(0.0)
fmt.Println(no)
no = math.Tanh(-2.9)
fmt.Println(no)
no = math.Tanh(2)
fmt.Println(no)
}
Output:
0.8336546070121552
-0.9910074536781176
0
-0.9939631673505831
0.9640275800758169
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/