aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic Hamon <dominic+github@google.com>2023-08-25 09:58:30 +0100
committerDominic Hamon <dominic+github@google.com>2023-08-25 09:58:30 +0100
commit78220d6f0d9b20d13cf671c64df029ca6c2f6b18 (patch)
tree55c14eee7d4c17e8c988679358b32b6dde00e208
parent9f254bddf096f384159697654fcef1940188f2ae (diff)
downloadgoogle-benchmark-78220d6f0d9b20d13cf671c64df029ca6c2f6b18.tar.gz
tweak comment wording
-rw-r--r--src/statistics.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/statistics.cc b/src/statistics.cc
index a0e828e..844e926 100644
--- a/src/statistics.cc
+++ b/src/statistics.cc
@@ -44,8 +44,9 @@ double StatisticsMedian(const std::vector<double>& v) {
// Did we have an odd number of samples? If yes, then center is the median.
// If not, then we are looking for the average between center and the value
- // before. Instead of resorting, we just look for the max value before it.
- // (Since `copy` is partially sorted.)
+ // before. Instead of resorting, we just look for the max value before it,
+ // which is not necessarily the element immediately preceding `center` Since
+ // `copy` is only partially sorted by `nth_element`.
if (v.size() % 2 == 1) return *center;
auto center2 = std::max_element(copy.begin(), center);
return (*center + *center2) / 2.0;