Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
d20dd69d
Commit
d20dd69d
authored
Nov 30, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix complex powers of negative real values.
Fixes GH issue #1538.
parent
320d3c44
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
Cython/Utility/Complex.c
Cython/Utility/Complex.c
+6
-2
tests/run/complex_numbers_T305.pyx
tests/run/complex_numbers_T305.pyx
+2
-0
No files found.
Cython/Utility/Complex.c
View file @
d20dd69d
...
...
@@ -264,9 +264,13 @@ static {{type}} __Pyx_PyComplex_As_{{type_name}}(PyObject* o) {
if
(
a
.
imag
==
0
)
{
if
(
a
.
real
==
0
)
{
return
a
;
}
}
else
if
(
a
.
real
>
0
)
{
r
=
a
.
real
;
theta
=
0
;
}
else
{
r
=
-
a
.
real
;
theta
=
atan2
{{
m
}}(
0
,
-
1
);
}
}
else
{
r
=
__Pyx_c_abs
{{
func_suffix
}}(
a
);
theta
=
atan2
{{
m
}}(
a
.
imag
,
a
.
real
);
...
...
tests/run/complex_numbers_T305.pyx
View file @
d20dd69d
...
...
@@ -48,6 +48,8 @@ def test_pow(double complex z, double complex w, tol=None):
True
>>> test_pow(complex(0.5, -.25), complex(3, 4), 1e-15)
True
>>> test_pow(-0.5, 1j, tol=1e-15)
True
"""
if
tol
is
None
:
return
z
**
w
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment