From 7f7395494a1f41e1da899e32de32def5fc0774f2 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:15:27 +0100 Subject: [PATCH] fixed files form Math #26 --- .../Math/26/org/apache/commons/math3/fraction/Fraction.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/Math/26/org/apache/commons/math3/fraction/Fraction.java b/projects/Math/26/org/apache/commons/math3/fraction/Fraction.java index f81ff0a..08d3b95 100644 --- a/projects/Math/26/org/apache/commons/math3/fraction/Fraction.java +++ b/projects/Math/26/org/apache/commons/math3/fraction/Fraction.java @@ -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); } @@ -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); }