-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Open
Description
For example:
np.isclose(complex(float('inf'), 0), complex(float('inf'), 0))
: False
np.isclose(complex(1, float('inf')), complex(1, float('nan')), equal_nan=True)
: True
In the first case it seems like the same number should be close to itself, and in the latter case I think the numbers should not be close since NaN is not close to anything.
Python's cmath.isclose behavior appears to demand that complex numbers containing -inf or inf must be identical to be close. It does not support equal_nan so complex numbers containing NaN are never close to other complex numbers. If equal_nan is True I would expect NaNs to act like infinities and require the numbers be identical to be "close."