diff --git a/src/maths.rs b/src/maths.rs index e49bb57..38af779 100644 --- a/src/maths.rs +++ b/src/maths.rs @@ -29,9 +29,7 @@ impl Rational { pub fn reduce(&self) -> Self { let gcd = gcd(self.numerator, self.denominator); let mut res = Rational::new(self.numerator / gcd, self.denominator / gcd); - if res.numerator < 0 && res.denominator < 0 { - res = -1 * res; - } else if res.denominator < 0 { + if res.denominator < 0 { res = Rational::new(-res.numerator, -res.denominator); } res