[issue11658] complex sqrt error

2011-03-24 Thread Mark Dickinson
Mark Dickinson added the comment: I don't see a real problem here: both cmath.sqrt(-1) and (-1)**0.5 are producing good approximations to the correct result, which is about as much as you can hope for in general with floating-point algorithms. I wouldn't want to start special-casing the comp

[issue11658] complex sqrt error

2011-03-23 Thread STINNER Victor
STINNER Victor added the comment: (-1)**.5 is the same than complex(-1,0)**.5, but it is computed differently than cmath.sqrt(-1). -1.**0.5 computes: vabs = math.hypot(-1, 0) len = pow(vabs, 0.5) at = math.atan2(0, -1) phase = at * 0.5 return complex(len*math.cos(phase), len*math.si

[issue11658] complex sqrt error

2011-03-23 Thread João Bernardo
New submission from João Bernardo : 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. >>> (-