C
Carcophan
Guest
Trying to understand a simple formula in some of the code I found in a tutorial. Hoping it isn't just wrong, so assuming it isn't "wrong", then why is it "right"?
The tutorial formula is: Var X = _cX * _var1 + _var1 / _var2;
Which works out specifically to: Var X = 16 * 32 + 32 / 2
Yes - They have Var1 + Var1
We all understand the order of operations as: P>E>M>D>A>S, but with no parenthesis, the final number I get is 272, and this numerically does not make sense in the code for what it is used for.
If I put my own parenthesis on it, I can work into (16 X 64) / 2 = 512 which is something a little more realistic, all things considered. But how can you get 'one from the other' if you didn't know?
The tutorial formula is: Var X = _cX * _var1 + _var1 / _var2;
Which works out specifically to: Var X = 16 * 32 + 32 / 2
Yes - They have Var1 + Var1
We all understand the order of operations as: P>E>M>D>A>S, but with no parenthesis, the final number I get is 272, and this numerically does not make sense in the code for what it is used for.
If I put my own parenthesis on it, I can work into (16 X 64) / 2 = 512 which is something a little more realistic, all things considered. But how can you get 'one from the other' if you didn't know?