diff --git a/quantile/stream.go b/quantile/stream.go index 56d722e..f4cabd6 100644 --- a/quantile/stream.go +++ b/quantile/stream.go @@ -133,7 +133,7 @@ if l == 0 { return 0 } - i := int(float64(l) * q + 0.5) // Add 0.5 because casting float to int always rounds down. + i := int(math.Ceil(float64(l) * q)) if i > 0 { i -= 1 }