Skip to content

Commit

Permalink
handle missing case for multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwparas committed Oct 27, 2024
1 parent 5f29e36 commit c3f84a4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/steel-core/src/primitives/numbers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,14 @@ 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 c3f84a4

Please sign in to comment.