math.Pow Go · 包功能
返回 x 的 y 次幂。
怎么用
math.Pow(x, y)
小例子
package main
import (
"fmt"
"math"
)
func main() {
fmt.Println(math.Pow(2, 3))
}
运行结果
输出 8
提醒:x 和 y 都必须是 float64
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Go全部词条math.Pow Go · 包功能返回 x 的 y 次幂。
math.Pow(x, y)
package main
import (
"fmt"
"math"
)
func main() {
fmt.Println(math.Pow(2, 3))
}
输出 8
提醒:x 和 y 都必须是 float64
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← Go全部词条