I've noticed that adding a space between subexpressions changes the behavior of implicit multiplication.
`4 / 2(1+1)` is interpreted as `4 / (2 * (1+1))` since an implicit multiplication operator is inserted between the 2 and the (1+1), and such operator has higher precedence than division.
However, `4 / 2 (1+1)`, with a space between the 2 and the (1+1), is interpreted as `(4/2) * (1+1)`, so in this case implicit multiplication does NOT have higher precedence than division.
I think this behavior is weird since it doesn't follow the rule of "spaces are mostly ignored", and can be particularly annoying when using units, like `10 m / 5 s` returning `2 m*s` instead of `2 m/s`, forcing me to use `10m / 5s`. Maybe it's my fault for using a space there, but I'm used to separating quantities from units with a space.
I'm not sure if this behavior could be considered as a bug, but I think it's a bit counter-intuitive so I'm reporting it just in case.
It's also annoying that I can't use units like `10 m / 5 m/s` without using parentheses, but that doesn't seem easy to fix so I guess I'll have to get used to it.
Log in to post a comment.