summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ipa/libipa/histogram.cpp3
-rw-r--r--test/ipa/libipa/meson.build2
2 files changed, 3 insertions, 2 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;
}
diff --git a/test/ipa/libipa/meson.build b/test/ipa/libipa/meson.build
index 83c84bd8..8c63ebd8 100644
--- a/test/ipa/libipa/meson.build
+++ b/test/ipa/libipa/meson.build
@@ -2,7 +2,7 @@
libipa_test = [
{'name': 'fixedpoint', 'sources': ['fixedpoint.cpp']},
- {'name': 'histogram', 'sources': ['histogram.cpp'], 'should_fail': true},
+ {'name': 'histogram', 'sources': ['histogram.cpp']},
{'name': 'interpolator', 'sources': ['interpolator.cpp']},
]