math.Sqrt Go · 包功能
返回非负实数的平方根。
怎么用
math.Sqrt(x)
小例子
package main
import (
"fmt"
"math"
)
func main() {
fmt.Println(math.Sqrt(16))
}
运行结果
输出 4
提醒:x 为负数时返回 NaN
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Go全部词条math.Sqrt Go · 包功能返回非负实数的平方根。
math.Sqrt(x)
package main
import (
"fmt"
"math"
)
func main() {
fmt.Println(math.Sqrt(16))
}
输出 4
提醒:x 为负数时返回 NaN
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Go全部词条