diff --git a/histogram.go b/histogram.go index 6a72cc5..c187999 100644 --- a/histogram.go +++ b/histogram.go @@ -14,7 +14,7 @@ const ( decimalMultiplier = 2 bucketSize = 9 * decimalMultiplier bucketsCount = e10Max - e10Min - decimalPrecision = 0.01 / decimalMultiplier + decimalPrecision = 1e-12 ) // Histogram is a histogram for non-negative values with automatically created buckets. diff --git a/histogram_test.go b/histogram_test.go index 47edb5c..8001665 100644 --- a/histogram_test.go +++ b/histogram_test.go @@ -55,6 +55,12 @@ func TestGetBucketIdxAndOffset(t *testing.T) { f((1+prec)*math.Pow10(e10Max), -1, 2) f((1+3*step+prec)*math.Pow10(e10Max), -1, 2) f(math.Inf(1), -1, 2) + + f(999, 11, 17) + f(1000, 11, 17) + f(1001, 12, 0) + f(1002, 12, 0) + f(1003, 12, 0) } func TestGetVMRange(t *testing.T) {