```Date: Mar 14, 2006 10:37 AM
Author: magidin@math.berkeley.edu
Subject: Re: Reason for operator precedence

In article <4416a498\$1_4@news.peopletelecom.com.au>,Tony <ignorethis@nowhere.com> wrote:>Hi all.>>Hope this isn't a silly question.>>I was wondering what the reason is for having multiple levels of operator >precedence?So that polynomials and rational functions can be writteneasily. That's essentially the main reason.>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.So, by "evaluting left to right", I assume that you mean thatsomething like   2 + 3 * 5would evaluate to 25, since 2 plus 3 is five, and then multiplyingthat by 5 yields 25.A general quadratic polynomial, using standard operator percedence, iswritten as:  ax^2 + bx + cAnd it can be written in other orders easily if you want:    c + bx + ax^2   bx + c + ax^2etc.How would you have to write it if you simply evaluated left to right?The smallest number of parenthesis I can come up with is: axx + (bx + c)which may obscure the degree. If you want to put in the square, youwould need to do something like bx + c + (a(x^2)).Higher degree polynomials would be even harder.-- ======================================================================"It's not denial. I'm just very selective about what I accept as reality."    --- Calvin ("Calvin and Hobbes")======================================================================Arturo Magidinmagidin@math.berkeley.edu
```