Hacker News new | past | comments | ask | show | jobs | submit login

PEMDAS is pretty easy to remember too. Though for programming the E isn't usually relevant unless it's python.



Is it PEMDAS or PEDMAS ?


Luckily, the M and D commute.

(...Over the reals. Your mileage may vary in less exact types. The Surgeon General recommends avoiding division in production code. Regulations vary by state.)


you can still run into problems with chains like 2×3÷4×5

    (2×3)÷(4×5) = 6÷20 = 0.3
    2×(3÷4)×5 = 10×0.75 = 7.5
    ((2×3)÷4)×5 = 7.5


Either/or.

That's kind of one problem with it, it's less PEMDAS and more P, E, MD, AS. Multiplication and division don't have precedence over each other and neither does addition and subtraction. Both of those go from left to right.


It's BEDMAS. B for brackets (which is what parentheses are called in Canada; see also square brackets, curly brackets, and angle brackets).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: