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)
105
105
const double ratio = b .imag / b .real ;
106
106
const double denom = b .real + b .imag * ratio ;
107
107
r .real = (a .real + a .imag * ratio ) / denom ;
108
- r .imag = (a .imag - a .real * ratio ) / denom ;
108
+ r .imag = (ratio ? a .imag - a . real * ratio : - a .real * ratio ) / denom ;
109
109
}
110
110
}
111
111
else if (abs_bimag >= abs_breal ) {
@@ -177,12 +177,10 @@ c_powu(Py_complex x, long n)
177
177
static Py_complex
178
178
c_powi (Py_complex x , long n )
179
179
{
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 )
184
181
return _Py_c_quot (c_1 , c_powu (x ,- n ));
185
- }
182
+ else
183
+ return c_powu (x ,n );
186
184
}
187
185
188
186
double
You can’t perform that action at this time.
0 commit comments