Skip to content

Commit

Permalink
Fix wrong comparison of floats in function compareValues
Browse files Browse the repository at this point in the history
  • Loading branch information
ostafen committed Mar 19, 2022
1 parent 1dffe20 commit da18a92
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion criteria.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package clover

import (
"encoding/json"
"math/big"
"reflect"
"strings"
)
Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit da18a92

Please sign in to comment.