From 80ba8d5dd9f8538b54cc8cb65206121678673ca5 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Mon, 23 Oct 2023 19:31:13 +0200 Subject: [PATCH] Replace and deprecate float.Round method Signed-off-by: Knut Ahlers --- float/round.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/float/round.go b/float/round.go index 9c201d0..913f49e 100644 --- a/float/round.go +++ b/float/round.go @@ -3,12 +3,8 @@ package float import "math" // Round returns a float rounded according to "Round to nearest, ties away from zero" IEEE floaing point rounding rule +// +// Deprecated: Starting with Go1.10 this should be replaced with math.Round() func Round(x float64) float64 { - var absx, y float64 - absx = math.Abs(x) - y = math.Floor(absx) - if absx-y >= 0.5 { - y += 1.0 - } - return math.Copysign(y, x) + return math.Round(x) }