Re: Reason for operator precedence
- From: "*** T. Winter" <***.Winter@xxxxxx>
- Date: Tue, 14 Mar 2006 13:31:57 GMT
In article <1142342196.542632.294210@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> matt271829-news@xxxxxxxxxxx writes:
Tony wrote:....
....I was wondering what the reason is for having multiple levels of operator
precedence?
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
That is not the reason. You could just as well have left to right
operation when you use sufficiently many parenthesis in the euqations.
E.g. 3*(4 + 6) = (3*4) + (3*6).
But try to write the polynomial x^7 + 2x^6 - 3x^5 + 2x^4 +7x^3 - 3x^2 - 5x + 8
without assuming precedence. It is to avoid large numbers of parenthesis.
--
*** t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~***/
.
- Follow-Ups:
- Re: Reason for operator precedence
- From: Toni Lassila
- Re: Reason for operator precedence
- From: matt271829-news
- Re: Reason for operator precedence
- References:
- Reason for operator precedence
- From: Tony
- Re: Reason for operator precedence
- From: matt271829-news
- Reason for operator precedence
- Prev by Date: Re: Adjunct site to sci.math needed
- Next by Date: Re: Symmetry Classes
- Previous by thread: Re: Reason for operator precedence
- Next by thread: Re: Reason for operator precedence
- Index(es):