You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2019/10/24 16:01:39 UTC
[commons-numbers] 02/02: Reduce risk of overflow.
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git
commit 43270ce8f2de0092de45ede7ba20190649978ea5
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Thu Oct 24 18:00:17 2019 +0200
Reduce risk of overflow.
Reported by "LGTM" analysis.
---
.../java/org/apache/commons/numbers/combinatorics/Combinations.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Combinations.java b/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Combinations.java
index c72711a..b779e34 100644
--- a/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Combinations.java
+++ b/commons-numbers-combinatorics/src/main/java/org/apache/commons/numbers/combinatorics/Combinations.java
@@ -380,7 +380,7 @@ public class Combinations implements Iterable<int[]> {
throw new CombinatoricsException(CombinatoricsException.OUT_OF_RANGE, digit, 0, n - 1);
}
- ret += c[i] * ArithmeticUtils.pow(n, i);
+ ret += c[i] * ArithmeticUtils.pow((long) n, i);
}
return ret;
}