num-complex changed their powc() implementation in 0.4.4, making it incompatible with what the regression tests expect. this is that old formula.
(a: Complex64, exp: Complex64)
| 173 | // num-complex changed their powc() implementation in 0.4.4, making it incompatible |
| 174 | // with what the regression tests expect. this is that old formula. |
| 175 | fn powc(a: Complex64, exp: Complex64) -> Complex64 { |
| 176 | let (r, theta) = a.to_polar(); |
| 177 | if r.is_zero() { |
| 178 | return Complex64::new(r, r); |
| 179 | } |
| 180 | Complex64::from_polar( |
| 181 | r.powf(exp.re) * (-exp.im * theta).exp(), |
| 182 | exp.re * theta + exp.im * r.ln(), |
| 183 | ) |
| 184 | } |
| 185 | |
| 186 | impl Constructor for PyComplex { |
| 187 | type Args = ComplexArgs; |