Bizarre arithmetic results

Mark Dickinson dickinsm at gmail.com
Thu Feb 11 07:27:14 EST 2010


On Feb 11, 12:44 am, Terrence Cole <list-
s... at trainedmonkeystudios.org> wrote:
> Can someone explain to me what python is doing here?

> >>> -0.1 ** 0.1
> -0.7943282347242815

Here you're computing -(0.1 ** 0.1).  The exponentiation operator
binds more strongly than the negation operator.

> >>> a = -0.1; b = 0.1
> >>> a ** b
> (0.7554510437117542+0.2454609236416552j)

Here you're computing (-0.1) ** 0.1.

--
Mark



More information about the Python-list mailing list