Skip to content

Commit 42be516

Browse files
committed
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.
1 parent 5bc73be commit 42be516

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

src/eval/ops.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,8 @@ pub fn div(lhs: Value, rhs: Value) -> StrResult<Value> {
215215
Ok(match (lhs, rhs) {
216216
(Int(a), Int(b)) => Float(a as f64 / b as f64),
217217
(Int(a), Float(b)) => Float(a as f64 / b),
218-
(Int(a), Ratio(b)) => Float(a as f64 / b),
219218
(Float(a), Int(b)) => Float(a / b as f64),
220219
(Float(a), Float(b)) => Float(a / b),
221-
(Float(a), Ratio(b)) => Float(a / b),
222220

223221
(Length(a), Int(b)) => Length(a / b as f64),
224222
(Length(a), Float(b)) => Length(a / b),

0 commit comments

Comments
 (0)