diff options
author | Robert Bradshaw <robertwb@google.com> | 2016-11-30 12:57:09 -0800 |
---|---|---|
committer | Robert Bradshaw <robertwb@google.com> | 2016-11-30 12:57:35 -0800 |
commit | ba0065411d516b2b36178eadf86957dfca289065 (patch) | |
tree | 9c88166ef71db386413c88de3882495eb5f5f911 /Cython/Utility/Complex.c | |
parent | d20dd69dd803026810b819e85e55effd1932feb1 (diff) | |
download | cython-ba0065411d516b2b36178eadf86957dfca289065.tar.gz |
Pure real results for pure real complex powers.
Diffstat (limited to 'Cython/Utility/Complex.c')
-rw-r--r-- | Cython/Utility/Complex.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Cython/Utility/Complex.c b/Cython/Utility/Complex.c index 64a440f6e..2b75ed282 100644 --- a/Cython/Utility/Complex.c +++ b/Cython/Utility/Complex.c @@ -264,6 +264,10 @@ static {{type}} __Pyx_PyComplex_As_{{type_name}}(PyObject* o) { if (a.imag == 0) { if (a.real == 0) { return a; + } else if (b.imag == 0) { + z.real = pow{{m}}(a.real, b.real); + z.imag = 0; + return z; } else if (a.real > 0) { r = a.real; theta = 0; |