diff --git a/poincare/src/arithmetic.cpp b/poincare/src/arithmetic.cpp index c4248fba3..136574761 100644 --- a/poincare/src/arithmetic.cpp +++ b/poincare/src/arithmetic.cpp @@ -7,7 +7,7 @@ Integer Arithmetic::LCM(const Integer & a, const Integer & b) { if (a.isZero() || b.isZero()) { return Integer(0); } - Integer signResult = Integer::Division(Integer::Multiplication(static_cast(a.clone()), static_cast(b.clone())), GCD(a, b)).quotient; + Integer signResult = Integer::Division(Integer::Multiplication(static_cast(a), static_cast(b)), GCD(a, b)).quotient; //TODO Check if clone required or not signResult.setNegative(false); return signResult; @@ -15,11 +15,11 @@ Integer Arithmetic::LCM(const Integer & a, const Integer & b) { Integer Arithmetic::GCD(const Integer & a, const Integer & b) { if (a.isInfinity() || b.isInfinity()) { - return Integer::Overflow(); + return Integer::Overflow(false); } - Integer i = static_cast(a.clone()); - Integer j = static_cast(b.clone()); + Integer i = a; + Integer j = b; i.setNegative(false); j.setNegative(false); do { @@ -45,7 +45,7 @@ void Arithmetic::PrimeFactorization(const Integer & n, Integer outputFactors[], assert(!n.isInfinity()); // Compute the absolute value of n - Integer m = static_cast(n.clone()); + Integer m = n; m.setNegative(false); /* First we look for prime divisors in the table primeFactors (to speed up diff --git a/poincare/src/binomial_coefficient.cpp b/poincare/src/binomial_coefficient.cpp index 5209c2af3..d2fa36ec4 100644 --- a/poincare/src/binomial_coefficient.cpp +++ b/poincare/src/binomial_coefficient.cpp @@ -90,8 +90,8 @@ Expression BinomialCoefficient::shallowReduce(Context & context, Preferences::An Rational r0 = static_cast(c0); Rational r1 = static_cast(c1); - Integer n = static_cast(r0.signedIntegerNumerator().clone()); - Integer k = static_cast(r1.signedIntegerNumerator().clone()); + Integer n = r0.signedIntegerNumerator(); + Integer k = r1.signedIntegerNumerator(); if (n.isLowerThan(k)) { Expression result = Undefined(); replaceWithInPlace(result);