Skip to content

Commit

Permalink
fixed files form Math #26
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 278844d commit 7f73954
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private Fraction(double value, double epsilon, int maxDenominator, int maxIterat
long overflow = Integer.MAX_VALUE;
double r0 = value;
long a0 = (long)FastMath.floor(r0);
if (a0 > overflow) {
if (FastMath.abs(a0) > overflow) {
throw new FractionConversionException(value, a0, 1l);
}

Expand Down Expand Up @@ -206,7 +206,7 @@ private Fraction(double value, double epsilon, int maxDenominator, int maxIterat
long a1 = (long)FastMath.floor(r1);
p2 = (a1 * p1) + p0;
q2 = (a1 * q1) + q0;
if ((p2 > overflow) || (q2 > overflow)) {
if ((FastMath.abs(p2) > overflow) || (FastMath.abs(q2) > overflow)) {
throw new FractionConversionException(value, p2, q2);
}

Expand Down

0 comments on commit 7f73954

Please sign in to comment.