Skip to content

Commit

Permalink
move case to the right spot
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwparas committed Oct 27, 2024
1 parent c3f84a4 commit 75dba1d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions crates/steel-core/src/primitives/numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,14 @@ fn multiply_two(x: &SteelVal, y: &SteelVal) -> Result<SteelVal> {
let y = SteelComplex::new(y.clone(), SteelVal::IntV(0));
multiply_complex(x, &y)
}
(SteelVal::BigRational(x), SteelVal::Rational(y)) => {
let mut res = BigRational::new(
BigInt::from(x.numer().clone()),
BigInt::from(x.denom().clone()),
);
res *= BigRational::new(BigInt::from(*y.numer()), BigInt::from(*y.denom()));
res.into_steelval()
}
_ => unreachable!(),
}
}
Expand Down Expand Up @@ -1365,14 +1373,6 @@ pub fn add_two(x: &SteelVal, y: &SteelVal) -> Result<SteelVal> {
debug_assert!(realp(y));
add_complex(x, &SteelComplex::new(y.clone(), SteelVal::IntV(0)))
}
(SteelVal::BigRational(x), SteelVal::Rational(y)) => {
let mut res = BigRational::new(
BigInt::from(x.numer().clone()),
BigInt::from(x.denom().clone()),
);
res *= BigRational::new(BigInt::from(*y.numer()), BigInt::from(*y.denom()));
res.into_steelval()
}
_ => unreachable!(),
}
}
Expand Down

0 comments on commit 75dba1d

Please sign in to comment.