]> source.dussan.org Git - poi.git/commitdiff
increase intermediate significance
authorPJ Fanning <fanningpj@apache.org>
Sat, 14 Aug 2021 09:53:38 +0000 (09:53 +0000)
committerPJ Fanning <fanningpj@apache.org>
Sat, 14 Aug 2021 09:53:38 +0000 (09:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892332 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/ss/formula/functions/PercentRank.java

index 1f4530b921964877634c6d6f4a66edf32b21355b..2612f507fa03958b203309366cc3a4c60d8c6392 100644 (file)
@@ -126,11 +126,12 @@ public final class PercentRank implements Function {
             BigDecimal result = new BigDecimal((double)lessThanCount / (double)(lessThanCount + greaterThanCount));
             return new NumberEval(round(result, significance));
         } else {
-            ValueEval belowRank = calculateRank(numbers, closestMatchBelow, significance + 3, false);
+            int intermediateSignificance = significance < 5 ? 8 : significance + 3;
+            ValueEval belowRank = calculateRank(numbers, closestMatchBelow, intermediateSignificance, false);
             if (!(belowRank instanceof NumberEval)) {
                 return belowRank;
             }
-            ValueEval aboveRank = calculateRank(numbers, closestMatchAbove, significance + 3, false);
+            ValueEval aboveRank = calculateRank(numbers, closestMatchAbove, intermediateSignificance, false);
             if (!(aboveRank instanceof NumberEval)) {
                 return aboveRank;
             }