summaryrefslogtreecommitdiff
path: root/Cython/Utility/Complex.c
diff options
context:
space:
mode:
authorRobert Bradshaw <robertwb@google.com>2016-11-30 12:57:09 -0800
committerRobert Bradshaw <robertwb@google.com>2016-11-30 12:57:35 -0800
commitba0065411d516b2b36178eadf86957dfca289065 (patch)
tree9c88166ef71db386413c88de3882495eb5f5f911 /Cython/Utility/Complex.c
parentd20dd69dd803026810b819e85e55effd1932feb1 (diff)
downloadcython-ba0065411d516b2b36178eadf86957dfca289065.tar.gz
Pure real results for pure real complex powers.
Diffstat (limited to 'Cython/Utility/Complex.c')
-rw-r--r--Cython/Utility/Complex.c4
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;