go Sqrt()

Sqrt()方法语法

func Sqrt(x float64) float64

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

Sqrt returns the square root of x.

Special cases are:

Sqrt(+Inf) = +Inf
Sqrt(±0) = ±0
Sqrt(x < 0) = NaN
Sqrt(NaN) = NaN

golang标准库的math.Sqrt()方法,接收一个参数x,并求取x的二次方根。除此之外,Sqrt(+Inf) = +Inf;Sqrt(±0) = ±0;Sqrt(x < 0) = NaN;Sqrt(NaN) = NaN。


math.Sqrt()方法实例代码

func main() {
	sqrt_num := math.Sqrt(36)
	fmt.Println(sqrt_num)
}

运行go文件,得到输出:

6

全栈后端 / go语法 :













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