Skip to content

BUG: Remove extra digit in binary_repr at limit#8674

Merged
charris merged 1 commit intonumpy:masterfrom
gfyoung:binary-repr-boundary
Feb 23, 2017
Merged

BUG: Remove extra digit in binary_repr at limit#8674
charris merged 1 commit intonumpy:masterfrom
gfyoung:binary-repr-boundary

Conversation

@gfyoung
Copy link
Contributor

@gfyoung gfyoung commented Feb 23, 2017

For negative numbers at the limit for a given number of digits, we were appending an extra digit.

Closes #8670.

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 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

Copy link
Contributor Author

@gfyoung gfyoung Feb 23, 2017

Choose a reason for hiding this comment

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

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).

Copy link
Member

@eric-wieser eric-wieser Feb 23, 2017

Choose a reason for hiding this comment

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

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.
@charris charris added this to the 1.12.1 release milestone Feb 23, 2017
@charris charris merged commit e057725 into numpy:master Feb 23, 2017
@charris
Copy link
Member

charris commented Feb 23, 2017

Thanks @gfyoung .

@gfyoung gfyoung deleted the binary-repr-boundary branch February 23, 2017 18:59
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Mar 4, 2017
@charris charris removed this from the 1.12.1 release milestone Mar 4, 2017
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.

3 participants