BUG: Remove extra digit in binary_repr at limit#8674
Merged
charris merged 1 commit intonumpy:masterfrom Feb 23, 2017
gfyoung:binary-repr-boundary
Merged
BUG: Remove extra digit in binary_repr at limit#8674charris merged 1 commit intonumpy:masterfrom gfyoung:binary-repr-boundary
charris merged 1 commit intonumpy:masterfrom
gfyoung:binary-repr-boundary
Conversation
eric-wieser
reviewed
Feb 23, 2017
numpy/core/tests/test_numeric.py
Outdated
Member
There was a problem hiding this comment.
I think I'd be happier with an explicit test for one of these case as well, since it's not immediately obvious that this tests the right thing
Contributor
Author
There was a problem hiding this comment.
So what are you saying that I have something like this?
assert_equal(np.binary_repr(-1, width=1), 1)
for width in range(1, 11):
...I'm not sure I fully understand what you are asking by having both an "explicit" test and the for loop together (seems redundant IMO).
Member
There was a problem hiding this comment.
Basically just add the exact test case from the issue, numpy.binary_repr(-128, 8), so it's obvious that the test is verifying the issue is fixed. Keep the loop too, but I think better to have both
For negative numbers at the limit for a given number of digits, we were appending an extra digit unnecessarily. Closes gh-8670.
eric-wieser
approved these changes
Feb 23, 2017
Member
|
Thanks @gfyoung . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For negative numbers at the limit for a given number of digits, we were appending an extra digit.
Closes #8670.