pow(-1,0) = 1, -1**0 = -1, why?
Dave Brueck
dbrueck at edgix.com
Tue Dec 19 14:04:06 EST 2000
Operator precedence:
>>> (-1)**0
1
>>> -(1**0)
-1
-Dave
> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Kirby Urner
> Sent: Tuesday, December 19, 2000 11:44 AM
> To: python-list at python.org
> Subject: pow(-1,0) = 1, -1**0 = -1, why?
>
>
>
> Python 2.0 (#8, Oct 16 2000, 17:27:58) [MSC 32 bit (Intel)] on win32
> Type "copyright", "credits" or "license" for more information.
> IDLE 0.6 -- press F1 for help
>
> >>> -1**0
> -1
> >>> pow(-1,0)
> 1
> >>> -10**0
> -1
> >>> pow(-10,0)
> 1
>
>
> These are inconsistent. I think pow() is giving the right answer.
>
> Kirby
>
> --
> http://www.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list