Bizarre arithmetic results

Albert van der Horst albert at spenarnc.xs4all.nl
Mon Feb 22 19:01:44 CET 2010


In article <mailman.2359.1265890457.28905.python-list at python.org>,
Terrence Cole  <terrence at zettabytestorage.com> wrote:
>Can someone explain to me what python is doing here?
>
>Python 3.1.1 (r311:74480, Feb  3 2010, 13:36:47)
>[GCC 4.3.4] on linux2
>Type "help", "copyright", "credits" or "license" for more information.
>>>> -0.1 ** 0.1

Python 4.0
Warning: misleading blank space, expected:
  - 0.1**0.1

>-0.7943282347242815
>>>> a = -0.1; b = 0.1
>>>> a ** b
>(0.7554510437117542+0.2454609236416552j)
>>>> -abs(a ** b)
>-0.7943282347242815
>
>Why does the literal version return the signed magnitude and the
>variable version return a complex?
>
>Cheers,
>Terrence
>


--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert at spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst




More information about the Python-list mailing list