Skip to content

Commit

Permalink
fixed files form Lang #22
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 0b5f153 commit 912a121
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion projects/Lang/22/org/apache/commons/lang3/math/Fraction.java
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,14 @@ public Fraction pow(int power) {
*/
private static int greatestCommonDivisor(int u, int v) {
// From Commons Math:
if ((u == 0) || (v == 0)) {
if ((u == Integer.MIN_VALUE) || (v == Integer.MIN_VALUE)) {
throw new ArithmeticException("overflow: gcd is 2^31");
}
return Math.abs(u) + Math.abs(v);
}
//if either operand is abs 1, return 1:
if (Math.abs(u) <= 1 || Math.abs(v) <= 1) {
if (Math.abs(u) == 1 || Math.abs(v) == 1) {
return 1;
}
// keep u and v negative, as negative integers range down to
Expand Down

0 comments on commit 912a121

Please sign in to comment.