From 7fd85808a3d7465f08b3e3cf22b37fd293a380b3 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Mon, 22 Jul 2019 19:44:00 +0200 Subject: [PATCH] Add Round methods. --- math.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/math.go b/math.go index 41eb240..05193cf 100644 --- a/math.go +++ b/math.go @@ -52,6 +52,16 @@ func NaN32() float32 { 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 func Sq(f float64) float64 { return f * f