The math Package
math has Sqrt, Pow, Abs, Floor, Ceil, Max, Min, Pi and more.
Example
package main
import (
"fmt"
"math"
)
func main() {
fmt.Println(math.Sqrt(16), math.Pow(2, 10), math.Abs(-3.5))
fmt.Println(math.Floor(2.9), math.Ceil(2.1), math.Max(3, 9), math.Pi)
}Result
4 1024 3.5 2 3 9 3.141592653589793
Exercise
Square root.
math.(16)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.