8000 MAINT: np.angle: Remove unnecessary multiplication · convexset/numpy@dc6b8df · GitHub
[go: up one dir, main page]

Skip to content

Commit dc6b8df

Browse files
committed
MAINT: np.angle: Remove unnecessary multiplication
1 parent 083aedb commit dc6b8df

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

numpy/lib/function_base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,18 +1339,18 @@ def angle(z, deg=0):
13391339
45.0
13401340
13411341
"""
1342-
if deg:
1343-
fact = 180/pi
1344-
else:
1345-
fact = 1.0
13461342
z = asarray(z)
13471343
if (issubclass(z.dtype.type, _nx.complexfloating)):
13481344
zimag = z.imag
13491345
zreal = z.real
13501346
else:
13511347
zimag = 0
13521348
zreal = z
1353-
return arctan2(zimag, zreal) * fact
1349+
1350+
a = arctan2(zimag, zreal)
1351+
if deg:
1352+
a *= 180/pi
1353+
return a
13541354

13551355

13561356
def unwrap(p, discont=pi, axis=-1):

0 commit comments

Comments
 (0)
0