You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2021/06/09 15:55:02 UTC

[commons-math] 07/09: Fix binary search for index overflow

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git

commit af647182efb2db902fb8fb5e696777c317248494
Author: aherbert <ah...@apache.org>
AuthorDate: Wed Jun 9 16:44:48 2021 +0100

    Fix binary search for index overflow
---
 .../apache/commons/math4/legacy/stat/descriptive/rank/Percentile.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/Percentile.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/Percentile.java
index 4527931..34fef44 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/Percentile.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/stat/descriptive/rank/Percentile.java
@@ -1357,7 +1357,7 @@ public class Percentile extends AbstractUnivariateStatistic implements Serializa
                 }
                 return lo;
             } else {
-                int mid = (lo + hi) / 2;
+                int mid = (lo + hi) >>> 1;
                 if (qsn == sk[mid]) {
                   return mid;
                 } else if (qsn > sk[mid]) {