Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » sci.math.* » sci.math

Topic: Reason for operator precedence
Replies: 15   Last Post: Mar 15, 2006 8:56 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 2,136
Registered: 1/25/05
Re: Reason for operator precedence
Posted: Mar 14, 2006 8:16 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Tony wrote:
> Hi all.
> Hope this isn't a silly question.
> I was wondering what the reason is for having multiple levels of operator
> precedence?
> Phrased another way, why is it that we don't just evaluate everything from
> left to right?
> Having multiple levels of precedence obviously adds complexity, so I assume
> there must be some payback. However, I don't see what it is.

As far as addition/subtraction vs multiplication/division is concerned,
one reason is to ensure that the distributive property of
multiplication works sensibly. For example, we want 3*(4 + 6) = 3*4 +
3*6 = 3*(6 + 4) = 3*6 + 3*4.

And for exponentiation we want, for example, 3*3^2 = 3^3, not (3*3)^2

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.