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.
This commit is contained in:
parent
5bc73be90f
commit
42be51609b
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user