Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

DOC: Update documentation of np.clip #15124

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

Merged
merged 2 commits into from
Jan 13, 2020
Merged

DOC: Update documentation of np.clip #15124

merged 2 commits into from
Jan 13, 2020

Conversation

bharatr21
Copy link
Contributor

Fixes #15061 by informing users and updating the documentation of np.clip

@@ -2033,7 +2033,8 @@ def clip(a, a_min, a_max, out=None, **kwargs):
is specified, values smaller than 0 become 0, and values larger
than 1 become 1.

Equivalent to but faster than ``np.maximum(a_min, np.minimum(a, a_max))``.
Equivalent to but faster than ``np.maximum(a_min, np.minimum(a, a_max))``
only if ``a_min < a_max`` else returns ``a_max``.
Copy link
Contributor

@tylerjereddy tylerjereddy Dec 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be surprised if it were this straightforward, but happy to be wrong :)

I though it was more like if amin > amax, strange things can happen depending on the nature of the input.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe simply "Assumes a_min < a_max"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it actually is this straightforward (whereas it didn't use to be). Bring deliberately vague here is probably good anyway though.

@mattip mattip merged commit 266c588 into numpy:master Jan 13, 2020
@mattip
Copy link
Member

mattip commented Jan 13, 2020

Thanks @Bharat123rox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

np.clip: change in precedence between minimum and maximum when maximum < minimum
4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.