On May 8, 6:14 pm, Luis Zarrabeitia <[EMAIL PROTECTED]> wrote:
> On Thursday 08 May 2008 06:54:42 pm [EMAIL PROTECTED] wrote:
>
> > The problem is that Python parses -123**0 as -(123**0), not as
> > (-123)**0.
>
> Actually, I've always written it as (-123)**0. At least where I'm from,
> exponentiation takes precedence even over unary "-". (to get a power of -123,
> you must write $(-123)^0$ [latex])

FWIW, my TI-89 evaluates it as -1.

> Though not an authoritative source, wikipedia also uses the (-x)^y 
> notation:http://en.wikipedia.org/wiki/Exponentiation#Powers_of_minus_one
>
> Btw, there seems to be a math problem in python with exponentiation...
>
> >>> 0**0
>
> 1
>
> That 0^0 should be a nan or exception, I guess, but not 1.
>
> [just found out while trying the poster's example]

Technically correct, but 0**0 == 1 is actually pretty useful.  For one
thing, it lets you create a Vandermonde matrix without making 0 a
special case.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to