We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97a5a8d commit 32bd37cCopy full SHA for 32bd37c
src/main/java/com/thealgorithms/bitmanipulation/BitwiseGCD.java
@@ -51,11 +51,7 @@ public static long gcd(long a, long b) {
51
if (a == Long.MIN_VALUE || b == Long.MIN_VALUE) {
52
// Delegate to BigInteger and try to return a long if it fits
53
BigInteger g = gcdBig(BigInteger.valueOf(a), BigInteger.valueOf(b));
54
- try {
55
- return g.longValueExact();
56
- } catch (ArithmeticException ex) {
57
- throw new ArithmeticException("GCD doesn't fit into signed long. Use gcdBig() for full-range result.");
58
- }
+ return g.longValueExact();
59
}
60
61
// Work with non-negative long values now (safe because we excluded Long.MIN_VALUE)
0 commit comments