From da18a9235e5e9abe088c2b660e16becf3cefa7e9 Mon Sep 17 00:00:00 2001 From: Stefano Date: Sat, 19 Mar 2022 17:13:26 +0100 Subject: [PATCH] Fix wrong comparison of floats in function compareValues --- criteria.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/criteria.go b/criteria.go index d00338e..c6e96c0 100644 --- a/criteria.go +++ b/criteria.go @@ -2,6 +2,7 @@ package clover import ( "encoding/json" + "math/big" "reflect" "strings" ) @@ -75,7 +76,7 @@ func compareValues(v1 interface{}, v2 interface{}) (int, bool) { if isFloat { v2Float, isFloat := v2.(float64) if isFloat { - return int(v1Float - v2Float), true + return big.NewFloat(v1Float).Cmp(big.NewFloat(v2Float)), true } }