I believe that multiplication and division have the same priority, so it goes from left to right.Why division has higher priority than multiplication?
I believe that multiplication and division have the same priority, so it goes from left to right.
I always recommend using parenthesis where necessary to make sure it calculates exactly they way you want.
In my opinion, if you have a sense of order of operations, then the additional parentheses hurts readability. With coworkers, in order to read their functions i have to go through and delete the extra parentheses they throw in. I don't know if that is just me though.
However, I do recommend unneeded parentheses in expressions like (40/2)*16 because the intent of 40/2*16 is unclear. Actually, I recommend that it be changed to 16*40/2
I respectfully disagree. If there is one thing that this thread shows, it is that most people do NOT understand the order of operations. So removing any confusion is not necessarily a bad thing. Does it hurt performance? I think not, so to make a formula one or two characters shorter really isn't any real advantage.In my opinion, if you have a sense of order of operations, then the additional parentheses hurts readability.