refacto(maths::solver): remove useless branch

This commit is contained in:
gbrochar 2023-11-19 12:55:18 +01:00
parent 6fb0c2480f
commit 869dca85c0
1 changed files with 1 additions and 3 deletions

View File

@ -29,9 +29,7 @@ impl Rational {
pub fn reduce(&self) -> Self { pub fn reduce(&self) -> Self {
let gcd = gcd(self.numerator, self.denominator); let gcd = gcd(self.numerator, self.denominator);
let mut res = Rational::new(self.numerator / gcd, self.denominator / gcd); let mut res = Rational::new(self.numerator / gcd, self.denominator / gcd);
if res.numerator < 0 && res.denominator < 0 { if res.denominator < 0 {
res = -1 * res;
} else if res.denominator < 0 {
res = Rational::new(-res.numerator, -res.denominator); res = Rational::new(-res.numerator, -res.denominator);
} }
res res