Add Round methods.

This commit is contained in:
Sander Schobers 2019-07-22 19:44:00 +02:00
parent a024db06c0
commit 7fd85808a3

10
math.go
View File

@ -52,6 +52,16 @@ func NaN32() float32 {
return float32(NaN()) return float32(NaN())
} }
// Round rounds to the nearest integer.
func Round(f float64) float64 {
return math.Round(f)
}
// Round32 rounds to the nearest integer.
func Round32(f float32) float32 {
return float32(math.Round(float64(f)))
}
// Sq the square root of the value // Sq the square root of the value
func Sq(f float64) float64 { func Sq(f float64) float64 {
return f * f return f * f