[Python-bugs-list] [ python-Bugs-649187 ] sqrt(-1) weirdness?

noreply@sourceforge.net noreply@sourceforge.net
Thu, 05 Dec 2002 14:26:34 -0800


Bugs item #649187, was opened at 2002-12-05 17:26
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=649187&group_id=5470

Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: H. Richard Harkins (hrharkins)
Assigned to: Nobody/Anonymous (nobody)
Summary: sqrt(-1) weirdness?

Initial Comment:
I was justing playing around with some complex number
stuff for kicks and ran across something I'm not sure
about, not having playing with complex numbers for any
real purpose for so long.  Anyway, here's the scenario:

>>> from math import sqrt
>>> sqrt(-1)
(Produces a ValueError)
>>> -1 ** .5
-1.0

Shouldn't each of these produce (0+1j)?  If not,
shouldn't the second case produce ValueError too?  It
should be the case that -1.0 ** 2 == -1.0 ** .5,
shouldn't it?

Rich


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=649187&group_id=5470