View Single Post
Join Date: Jun 2008
Posts: 973
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Solved Threads: 107
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Posting Shark

Re: Where does Modulus fit in with PEMDAS?

 
0
  #4
Nov 9th, 2008
Now I'm curious...

When would it ever matter if you multiplied before dividing or subtract before adding?

Multiplication and division are technically the same.

Your expression 2 / 5 * 9 is the same as 2 * .2 * 9 so why in the world would it matter if you multiplied first instead of dividing?

Maybe it's because you're using int division?

The same argument exists for subtracting and adding. 2 - 5 + 9 is the same as 2 + -5 + 9 which will yield the same results despite whether you add or subtract first.

Are you using unsigned types?


And if modulus has equal precedence then I suppose my program is technically correct, but I would like it to have either stronger or weaker precedence before MD or after MD.

And Vernon I know you are the mathy-type so I am looking over your post carefully, trying to understand what you mean when you say I need a third option (i.e. Modulus before Division but after Multiplication), when M and D are technically the same?

-Alex
Reply With Quote