package main
import (
"fmt"
"math"
)
func main() {
i := 1
fmt.Prinln(math.Abs(float64(i))) // 绝对值
fmt.Println(math.Ceil(3.8)) // 向上取整数
fmt.Println(math.Floor(3.6)) //向下取整
fmt.Println(math.Mod(11, 3)) //取余数
fmt.Println(math.Modf(3.22)) // 取整数和小数
fmt.Println(math.Pow(3, 2)) //x的y次方
fmt.Println(math.Sqrt(8)) // 开平方
fmt.Println(math.Cbrt(8)) //开立方
fmt.Println(math.Pi) //π
}
原文:https://www.cnblogs.com/xianqingsong/p/11994437.html