diff --git a/source/util/src/tdigest.c b/source/util/src/tdigest.c index 1b9edf79a0..dc2a943de9 100644 --- a/source/util/src/tdigest.c +++ b/source/util/src/tdigest.c @@ -263,7 +263,7 @@ double tdigestQuantile(TDigest *t, double q) { b = c; right = (b->weight * a->mean + a->weight * b->mean) / (a->weight + b->weight); if (idx < weight_so_far + a->weight) { - double p = (idx - weight_so_far) / (a->weight == 0) ? 1 : a->weight; + double p = (idx - weight_so_far) / ((a->weight == 0) ? 1 : a->weight); return left * (1 - p) + right * p; } weight_so_far += a->weight;