Skip to content

Commit da18a92

Browse files
committed
Fix wrong comparison of floats in function compareValues
1 parent 1dffe20 commit da18a92

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

criteria.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package clover
22

33
import (
44
"encoding/json"
5+
"math/big"
56
"reflect"
67
"strings"
78
)
@@ -75,7 +76,7 @@ func compareValues(v1 interface{}, v2 interface{}) (int, bool) {
7576
if isFloat {
7677
v2Float, isFloat := v2.(float64)
7778
if isFloat {
78-
return int(v1Float - v2Float), true
79+
return big.NewFloat(v1Float).Cmp(big.NewFloat(v2Float)), true
7980
}
8081
}
8182

0 commit comments

Comments
 (0)