diff --git a/go.mod b/go.mod index c55d847b7120a..52a34d448c8c7 100644 --- a/go.mod +++ b/go.mod @@ -114,7 +114,7 @@ require ( require ( github.com/Azure/go-autorest/autorest v0.11.29 - github.com/DataDog/sketches-go v1.4.4 + github.com/DataDog/sketches-go v1.4.6 github.com/DmitriyVTitov/size v1.5.0 github.com/IBM/go-sdk-core/v5 v5.13.1 github.com/IBM/ibm-cos-sdk-go v1.10.0 diff --git a/go.sum b/go.sum index 39d0ec92e4640..07561f75760ec 100644 --- a/go.sum +++ b/go.sum @@ -244,8 +244,8 @@ github.com/Code-Hex/go-generics-cache v1.5.1 h1:6vhZGc5M7Y/YD8cIUcY8kcuQLB4cHR7U github.com/Code-Hex/go-generics-cache v1.5.1/go.mod h1:qxcC9kRVrct9rHeiYpFWSoW1vxyillCVzX13KZG8dl4= github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/sketches-go v1.4.4 h1:dF52vzXRFSPOj2IjXSWLvXq3jubL4CI69kwYjJ1w5Z8= -github.com/DataDog/sketches-go v1.4.4/go.mod h1:XR0ns2RtEEF09mDKXiKZiQg+nfZStrq1ZuL1eezeZe0= +github.com/DataDog/sketches-go v1.4.6 h1:acd5fb+QdUzGrosfNLwrIhqyrbMORpvBy7mE+vHlT3I= +github.com/DataDog/sketches-go v1.4.6/go.mod h1:7Y8GN8Jf66DLyDhc94zuWA3uHEt/7ttt8jHOBWWrSOg= github.com/DataDog/zstd v1.3.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/DmitriyVTitov/size v1.5.0 h1:/PzqxYrOyOUX1BXj6J9OuVRVGe+66VL4D9FlUaW515g= github.com/DmitriyVTitov/size v1.5.0/go.mod h1:le6rNI4CoLQV1b9gzp1+3d7hMAD/uu2QcJ+aYbNgiU0= diff --git a/vendor/github.com/DataDog/sketches-go/ddsketch/ddsketch.go b/vendor/github.com/DataDog/sketches-go/ddsketch/ddsketch.go index 33a0ea5b2bd66..27bd0e7aef303 100644 --- a/vendor/github.com/DataDog/sketches-go/ddsketch/ddsketch.go +++ b/vendor/github.com/DataDog/sketches-go/ddsketch/ddsketch.go @@ -173,7 +173,13 @@ func (s *DDSketch) GetValueAtQuantile(quantile float64) (float64, error) { return math.NaN(), errEmptySketch } - rank := quantile * (count - 1) + // Use an explicit floating point conversion (as per Go specification) to make sure that no + // "fused multiply and add" (FMA) operation is used in the following code subtracting values + // from `rank`. Not doing so can lead to inconsistent rounding and return value for this + // function, depending on the architecture and whether FMA operations are used or not by the + // compiler. + rank := float64(quantile * (count - 1)) + negativeValueCount := s.negativeValueStore.TotalCount() if rank < negativeValueCount { return -s.Value(s.negativeValueStore.KeyAtRank(negativeValueCount - 1 - rank)), nil diff --git a/vendor/modules.txt b/vendor/modules.txt index 79399e154d408..bc4cba78abd02 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -186,8 +186,8 @@ github.com/Code-Hex/go-generics-cache/policy/lfu github.com/Code-Hex/go-generics-cache/policy/lru github.com/Code-Hex/go-generics-cache/policy/mru github.com/Code-Hex/go-generics-cache/policy/simple -# github.com/DataDog/sketches-go v1.4.4 -## explicit; go 1.15 +# github.com/DataDog/sketches-go v1.4.6 +## explicit; go 1.18 github.com/DataDog/sketches-go/ddsketch github.com/DataDog/sketches-go/ddsketch/encoding github.com/DataDog/sketches-go/ddsketch/mapping