diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-04-11 21:39:46 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-04-11 21:39:46 +0200 |
| commit | 42be51609b82675c8df4bdfdade209c4dacc8721 (patch) | |
| tree | ead8dc48dc3e0e928c720d8b57fba51220f44d21 | |
| parent | 5bc73be90fdb7d46ea67bc00babc5f4833854306 (diff) | |
Remove support for number / ratio
If `1 * 40%` and `1 / 40%` both work, then I would expect `1cm * 40%` and `1cm / 40%` to work, too.
So the result of both multiplication and division is always the left type. Same with `100% * 40%`. But `100% / 40%` does not return a ratio, it returns a float. This breaks the consistency. For this reason, I am removing support for just the new divisions for now, but we can revisit this.
| -rw-r--r-- | src/eval/ops.rs | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/eval/ops.rs b/src/eval/ops.rs index 91160c0d..963c828b 100644 --- a/src/eval/ops.rs +++ b/src/eval/ops.rs @@ -215,10 +215,8 @@ pub fn div(lhs: Value, rhs: Value) -> StrResult<Value> { Ok(match (lhs, rhs) { (Int(a), Int(b)) => Float(a as f64 / b as f64), (Int(a), Float(b)) => Float(a as f64 / b), - (Int(a), Ratio(b)) => Float(a as f64 / b), (Float(a), Int(b)) => Float(a / b as f64), (Float(a), Float(b)) => Float(a / b), - (Float(a), Ratio(b)) => Float(a / b), (Length(a), Int(b)) => Length(a / b as f64), (Length(a), Float(b)) => Length(a / b), |
