From db24996161e275de9bdca8d3bbcbb9ef31abd762 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 11 Apr 2023 21:40:39 +0200 Subject: [PATCH] Add support for more ratio multiplications --- src/eval/ops.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/eval/ops.rs b/src/eval/ops.rs index 963c828bd..948243d12 100644 --- a/src/eval/ops.rs +++ b/src/eval/ops.rs @@ -171,29 +171,37 @@ pub fn mul(lhs: Value, rhs: Value) -> StrResult { (Length(a), Int(b)) => Length(a * b as f64), (Length(a), Float(b)) => Length(a * b), + (Length(a), Ratio(b)) => Length(a * b.get()), (Int(a), Length(b)) => Length(b * a as f64), (Float(a), Length(b)) => Length(b * a), + (Ratio(a), Length(b)) => Length(b * a.get()), (Angle(a), Int(b)) => Angle(a * b as f64), (Angle(a), Float(b)) => Angle(a * b), + (Angle(a), Ratio(b)) => Angle(a * b.get()), (Int(a), Angle(b)) => Angle(a as f64 * b), (Float(a), Angle(b)) => Angle(a * b), + (Ratio(a), Angle(b)) => Angle(a.get() * b), (Ratio(a), Ratio(b)) => Ratio(a * b), (Ratio(a), Int(b)) => Ratio(a * b as f64), (Ratio(a), Float(b)) => Ratio(a * b), - (Float(a), Ratio(b)) => Ratio(a * b), (Int(a), Ratio(b)) => Ratio(a as f64 * b), + (Float(a), Ratio(b)) => Ratio(a * b), (Relative(a), Int(b)) => Relative(a * b as f64), (Relative(a), Float(b)) => Relative(a * b), + (Relative(a), Ratio(b)) => Relative(a * b.get()), (Int(a), Relative(b)) => Relative(a as f64 * b), (Float(a), Relative(b)) => Relative(a * b), + (Ratio(a), Relative(b)) => Relative(a.get() * b), - (Float(a), Fraction(b)) => Fraction(a * b), (Fraction(a), Int(b)) => Fraction(a * b as f64), (Fraction(a), Float(b)) => Fraction(a * b), + (Fraction(a), Ratio(b)) => Fraction(a * b.get()), (Int(a), Fraction(b)) => Fraction(a as f64 * b), + (Float(a), Fraction(b)) => Fraction(a * b), + (Ratio(a), Fraction(b)) => Fraction(a.get() * b), (Str(a), Int(b)) => Str(a.repeat(b)?), (Int(a), Str(b)) => Str(b.repeat(a)?),