Re: Order of operations (was: Eigenvalues &/or eigenvectors,
Re: Order of operations (was: Eigenvalues &/or eigenvectors,
- Subject: Re: Order of operations (was: Eigenvalues &/or eigenvectors,
- From: email@hidden (Michael Sullivan)
- Date: Fri, 9 May 2003 15:54:09 -0400
- Organization: Business Card Express
email@hidden (Dave Stewart) writes:
>
Personally, I originally read this the same way as Michelle. I wondered
>
what the fuss was all about when I first encountered this diversion
>
(let's face it ... we've diverged from the original topic!).
>
On the other hand, whenever I'm just not sure if the compiler will obey
>
or not, I use parenthesis. It's anal I know, but ...
>
(-2)^2 will always produce 4 in any language [1]
>
-(2^2) will always produce -4 in any language [1]
>
When that doesn't work, then I scream BUG! ;-)
If you're going to spend the resources and lose the flexibility of
programming necessary to use algebraic precedence *at all*, then you
should *use* *algebraic* *precedence*, not some bastardized,
non-standard almost version that happens to match a few people's
intuitions better than the universal standard does.
There are huge benefits to ignoring precedence completely (a la lisp or
smalltalk -- you can redefine operators and parse mathematical
expressions in the language without much fuss). The benefits from using
infix algebraic notation are only useful if it is implemented in a
standard fashion. If you want to square minus-2 or x, or anything else,
you write it (-2)^2. It's ridiculous to have the minus have a higher
precedence than the power operator, because it just gets lost if the
power is even.
Michael
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.