[Libreoffice-commits] core.git: sc/source
Takeshi Abe
tabe at fixedpoint.jp
Tue Jul 3 09:50:30 UTC 2018
sc/source/core/tool/interpr3.cxx | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
New commits:
commit e46df81b679cbb44235e891c81e8b30ae50b31d4
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Mon Jun 11 13:18:31 2018 +0900
sc: A micro optimization of PERCENTILE() for interpolation cases
As the leading std::nth_element() already partitions the vector,
all we have to do is to pick the minimum in its latter part.
Change-Id: I7767edc538819251c8fe9d26441ae57b06b2f865
Reviewed-on: https://gerrit.libreoffice.org/55575
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index d85d1a561073..78756b0810e8 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3406,8 +3406,7 @@ double ScInterpreter::GetPercentile( vector<double> & rArray, double fPercentile
{
OSL_ENSURE(nIndex < nSize-1, "GetPercentile: wrong index(2)");
double fVal = *iter;
- iter = rArray.begin() + nIndex+1;
- ::std::nth_element( rArray.begin(), iter, rArray.end());
+ iter = ::std::min_element( rArray.begin() + nIndex + 1, rArray.end());
return fVal + fDiff * (*iter - fVal);
}
}
@@ -3438,8 +3437,7 @@ double ScInterpreter::GetPercentileExclusive( vector<double> & rArray, double fP
{
OSL_ENSURE(nIndex < nSize1, "GetPercentile: wrong index(2)");
double fVal = *iter;
- iter = rArray.begin() + nIndex + 1;
- ::std::nth_element( rArray.begin(), iter, rArray.end());
+ iter = ::std::min_element( rArray.begin() + nIndex + 1, rArray.end());
return fVal + fDiff * (*iter - fVal);
}
}
More information about the Libreoffice-commits
mailing list