Thread: 62(1+2) = ?
View Single Post
Old April 29th, 2011, 02:16 PM   #93 (permalink)
EarlyMon
The PearlyMon
 
EarlyMon's Avatar
 
Join Date: Jun 2010
Location: New Mexico, USA
Posts: 46,378
 
Device(s): M8, LTEvo, 3vo, and Shift - Evo retired
Carrier: Sprint

Thanks: 42,731
Thanked 57,187 Times in 22,979 Posts
Default

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.
EarlyMon is offline  
Reply With Quote
The Following 3 Users Say Thank You to EarlyMon For This Useful Post:
DaSchmarotzer (April 29th, 2011), Ichapp (April 30th, 2011), krouget (May 2nd, 2011)