Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistency in np.isclose #7014

Closed
andyfaff opened this issue Jan 15, 2016 · 0 comments

Comments

@andyfaff
Copy link
Contributor

commented Jan 15, 2016

The documentation for np.isclose says:

Returns a boolean array of where a and b are equal within the given tolerance. If both a and b are scalars, returns a single boolean value.

This is true for comparing two finite scalars, a single boolean value is returned:

>>> np.isclose(0, 1)
False

However, a boolean array is returned when one or more of the scalars is non-finite:

>>> np.isclose(0, np.inf)
array([False], dtype=bool)

I would expect (from the documentation) the above to return a single boolean value, not an array. I note that both values in the last example are scalars:

>>> np.isscalar(0)
True
>>> np.isscalar(np.inf)
True
@charris charris closed this in 4d87d90 Jan 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.