Add Round methods.
This commit is contained in:
parent
a024db06c0
commit
7fd85808a3
10
math.go
10
math.go
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user