4 ms·
> Adding parentheses makes things clearer in 99% of the cases I will challenge that in saying that 9*2+3/2^3 is clearer than the far more noisy (9*2
by bruce343434 4y ago
> Adding parentheses makes things clearer in 99% of the cases
I will challenge that in saying that
9*2+3/2^3
is clearer than the far more noisy
(9*2)+(3/(2^3))
Precedence is something you learn in high school.
edit: fighting with the painful markdown of hn
- pasc1878 4y agoIt is not that easy see the many threads over BODMAS/PEDMAS/BEDMAS. If you actually do maths you never have the / or ÷ operator in writing equations it is always a horizontal line so you can't write maths in one line. In your case I think the bracketed form is easier to read If forced to write on one line suspect I would write as 9*2 + 3/(2^3)
- nerdponx 4y agoAnd multiplication is very often written as two variables just sitting next to each other with no additional operator character in between. ((2*a) + (2*b)) / c in math would be 2a + 2b ------- c Traditional precedence rules make more sense with traditional handwritten notation.
- laumars 4y agoI think all the points there are true: The latter example is more noisy, you do learn precedence in high school yet the latter example is also more clear because it is the most accurate way of conveying intent.
- nerdponx 4y agoThis is the 1% of cases!