8000 Merge pull request #7489 from anntzer/faster-real-if-close · numpy/numpy@2af06c8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2af06c8

Browse files
committed
Merge pull request #7489 from anntzer/faster-real-if-close
Faster real_if_close.
2 parents 25d60a9 + 9fba2cb commit 2af06c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

numpy/lib/type_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def real_if_close(a,tol=100):
424424
from numpy.core import getlimits
425425
f = getlimits.finfo(a.dtype.type)
426426
tol = f.eps * tol
427-
if _nx.allclose(a.imag, 0, atol=tol):
427+
if _nx.all(_nx.absolute(a.imag) < tol):
428428
a = a.real
429429
return a
430430

0 commit comments

Comments
 (0)
0