File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ _Py_c_quot(Py_complex a, Py_complex b)
105105 const double ratio = b .imag / b .real ;
106106 const double denom = b .real + b .imag * ratio ;
107107 r .real = (a .real + a .imag * ratio ) / denom ;
108- r .imag = (a .imag - a .real * ratio ) / denom ;
108+ r .imag = (a .imag ? a . imag - a . real * ratio : - a .real * ratio ) / denom ;
109109 }
110110 }
111111 else if (abs_bimag >= abs_breal ) {
@@ -177,12 +177,10 @@ c_powu(Py_complex x, long n)
177177static Py_complex
178178c_powi (Py_complex x , long n )
179179{
180- if (n > 0 )
181- return c_powu (x ,n );
182- else {
183- c_1 .imag = - copysign (0.0 , x .imag );
180+ if (n < 0 )
184181 return _Py_c_quot (c_1 , c_powu (x ,- n ));
185- }
182+ else
183+ return c_powu (x ,n );
186184}
187185
188186double
You can’t perform that action at this time.
0 commit comments