[New-bugs-announce] [issue11658] complex sqrt error

João Bernardo report at bugs.python.org
Thu Mar 24 03:30:52 CET 2011

New submission from João Bernardo <jbvsmo at gmail.com>:

With Python 3, the ** operator is supposed to do math with complex numbers, but look what is happening:

Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> (-1)**.5
>>> import cmath
>>> cmath.sqrt(-1)
>>> pow(-1, .5)
>>> (-4)**.5

I also tried with Python 3.1.2 in my 32-bit Ubuntu 10.10 installation and got the same results.

The error seems to be in the floating point (double) representation limit of 16 decimal places.

components: None
messages: 131951
nosy: JBernardo
priority: normal
severity: normal
status: open
title: complex sqrt error
type: behavior
versions: Python 3.1, Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list