summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/lib/function_base.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 1a43da8b0..ea6339514 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -1339,10 +1339,6 @@ def angle(z, deg=0):
45.0
"""
- if deg:
- fact = 180/pi
- else:
- fact = 1.0
z = asarray(z)
if (issubclass(z.dtype.type, _nx.complexfloating)):
zimag = z.imag
@@ -1350,7 +1346,11 @@ def angle(z, deg=0):
else:
zimag = 0
zreal = z
- return arctan2(zimag, zreal) * fact
+
+ a = arctan2(zimag, zreal)
+ if deg:
+ a *= 180/pi
+ return a
def unwrap(p, discont=pi, axis=-1):