Re: Minus-Hyphen, Numeric Negation and Subtraction
Re: Minus-Hyphen, Numeric Negation and Subtraction
- Subject: Re: Minus-Hyphen, Numeric Negation and Subtraction
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 5 Jun 2009 01:46:14 -0400
> (I was taught, in school, that -2^2 was a negative number but that's another
> question.)
I could have sworn we just had a long thread about this very topic
mere months ago.
Well, I doubt you were taught anything about "-2^2" in school. :)
What you were taught that "-2²" is a negative number. It's clearer
with superscripts; the ambiguity jumps out when you have an operator
for exponentiation instead.
Anyway, yes, the standard in mathematical notation is that it means
"-(2²)", not "(-2)²". This is a fine rule, but it is also arbitrary,
and since exponentiation is not as common an operation as addition and
multiplication, it's also less well-known than My Dear Aunt Sally -
and therefore less widely implemented.
It's true that the major proglangs that have infix exponentiation
operators at all agree with your math teacher: Awk, Basic, Fortran,
Lua, Pascal, Perl, Python, and Ruby all give -4. On the other hand,
Microsoft Excel (and compatible spreadsheet programs) gives +4, as do
the UNIX basic calculator program bc(1), the built-in arithmetic in
the bash and Korn shells, and the Rexx programming language, So
AppleScript is in the minority here, but hardly alone.
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden