sc/source/core/tool/interpr3.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
New commits: commit 79aed20c3d48b2be5cdee5de42559649db0eb5fa Author: Eike Rathke <er...@redhat.com> AuthorDate: Mon Mar 6 00:34:29 2023 +0100 Commit: Eike Rathke <er...@redhat.com> CommitDate: Mon Mar 6 17:53:12 2023 +0000 For LARGE() the rank is to be rounded up, not down See https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#LARGE vs https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#SMALL Change-Id: Ib2c9aa11c41da5ce7f9872a949017035a7b70758 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148289 Tested-by: Jenkins Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index 578ff4584eb3..0153ee612e1c 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -3650,8 +3650,8 @@ void ScInterpreter::CalculateSmallLarge(bool bSmall) std::vector<SCSIZE> aRankArray; aRankArray.reserve(nRankArraySize); std::transform(aArray.begin(), aArray.end(), std::back_inserter(aRankArray), - [](double f) { - f = rtl::math::approxFloor(f); + [bSmall](double f) { + f = (bSmall ? rtl::math::approxFloor(f) : rtl::math::approxCeil(f)); // Valid ranks are >= 1. if (f < 1.0 || !o3tl::convertsToAtMost(f, std::numeric_limits<SCSIZE>::max())) return static_cast<SCSIZE>(0);