math包,go sdk用来做数学运算的包。
func main() { //四舍五入 fmt.Println(math.Round(3.4)) fmt.Println(math.Round(3.5)) //绝对值 fmt.Println(math.Abs(-3.4)) //乘方 fmt.Println(math.Pow(2,3)) //开方根 fmt.Println(math.Sqrt(9)) }
原文:https://www.cnblogs.com/paad/p/10969099.html