April 29th, 2011, 02:16 PM
|
#93 (permalink)
|
|
The PearlyMon
Join Date: Jun 2010
Location: New Mexico, USA
Posts: 36,163
Device(s): LTEvo, 3vo, and Shift
Carrier: Sprint
Thanks: 35,209
Thanked 42,011 Times in 17,292 Posts
|
A*B*C = A*C*B
It's not operator location that implies precedence - it's only operator type and parens that set that.
Probably the only reason the confusion ever existed is because at some point around 20 years ago compilers popularly ended up whenever there was code like this and evaluating multiplications first, then divisions - leading to computation tools that enforced the thinking that leads to the wrong conclusion.
6
--------
2(1+2)
and
6(1+2)
--------
2
are both correctly hand-written notations of two different problems.
6/2(1+2) is machine-form (the typewriter) notation - and so only the conservative and strict rules may apply, to free from compiler confusions.
A * B * C = A * C * B
A / B * C = A * C / B
Therefore = 9.
|
|
|