refacto(maths::solver): remove useless branch
This commit is contained in:
parent
6fb0c2480f
commit
869dca85c0
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue