fix(all): fixed coverity problem

This commit is contained in:
Alex Duan 2022-10-24 09:58:19 +08:00
parent 699b573b6f
commit 104e8f212a
1 changed files with 1 additions and 1 deletions

View File

@ -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;