You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
binary_repr returns an error when a negative number that cannot be represented at the requested width is provided as input. When -2**width is input the output is erroneously zeros.
When inputting positive numbers that cannot be represented the output is the largest representable number; the negative analogue would be a sensible behaviour.
Example:
`
import numpy as np
np.binary_repr(-8, width=3)
np.binary_repr(-9, width=3)
`
my numpy version is 1.8.2
Activity
gfyoung commentedon Feb 2, 2016
While your version of
numpyis a little out of date, I can replicate that issue in1.10.4.gfyoung commentedon Feb 2, 2016
Actually, in
1.10.4,np.binary_reprcan properly represent-1, though admittedly the representations of other negative numbers is a little buggy.BUG: Fix binary_repr for negative numbers