go math.Atan(),反正切
Atan()方法语法
func Atan(x float64) float64
go源码对Atan()方法的介绍:
Atan returns the arctangent, in radians, of x.
Special cases are:
Atan(±0) = ±0
Atan(±Inf) = ±Pi/2
golang标准库math中,Atan()方法,可计算参数x的反正切值,其中反正切值为弧度制的值,可以通过乘以180除以π的方法来转换为角度制的值。除此之外,Atan(±0) = ±0;Atan(±Inf) = ±Pi/2。
math.Atan()方法实例代码
下方实例,math.Atan()方法求取1的反正切值,并通过乘以180除以π的方法来转换为角度制的值:
func main() {
var a float64 = math.Atan(1)
a = a * 180 / math.Pi
fmt.Println(a)
}
运行go文件,得到输出:
45