go Tanh(),双曲正切

Tanh()方法语法

func Tanh(x float64) float64

go源码对Tanh()方法的介绍:

Tanh returns the hyperbolic tangent of x.

Special cases are:

Tanh(±0) = ±0
Tanh(±Inf) = ±1
Tanh(NaN) = NaN

golang标准库math模块中的Tanh()方法,可求取float64类型参数x的双曲正切值,除此之外,Tanh(±0) = ±0;Tanh(±Inf) = ±1;Tanh(NaN) = NaN。


math.Tanh()方法实例代码

func main() {
	tanh_v := math.Tanh(0.1)
	fmt.Println(tanh_v)
}

运行go文件,得到输出:

0.09966799462495582

全栈后端 / go语法 :













Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.