summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-04-11 21:40:39 +0200
committerLaurenz <laurmaedje@gmail.com>2023-04-11 21:40:39 +0200
commitdb24996161e275de9bdca8d3bbcbb9ef31abd762 (patch)
tree3a8ec5d994436070f1ba5f0220ac9c3993f8e858 /src
parent42be51609b82675c8df4bdfdade209c4dacc8721 (diff)
Add support for more ratio multiplications
Diffstat (limited to 'src')
-rw-r--r--src/eval/ops.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/eval/ops.rs b/src/eval/ops.rs
index 963c828b..948243d1 100644
--- a/src/eval/ops.rs
+++ b/src/eval/ops.rs
@@ -171,29 +171,37 @@ pub fn mul(lhs: Value, rhs: Value) -> StrResult<Value> {
(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)?),