summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ipa/libipa/histogram.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp
index 10e44b54..ea042f0a 100644
--- a/src/ipa/libipa/histogram.cpp
+++ b/src/ipa/libipa/histogram.cpp
@@ -130,7 +130,8 @@ double Histogram::quantile(double q, uint32_t first, uint32_t last) const
if (cumulative_[first + 1] == cumulative_[first])
frac = 0;
else
- frac = (item - cumulative_[first]) / (cumulative_[first + 1] - cumulative_[first]);
+ frac = (q * total() - cumulative_[first])
+ / (cumulative_[first + 1] - cumulative_[first]);
return first + frac;
}