summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
authordhuard <dhuard@localhost>2007-12-13 19:24:43 +0000
committerdhuard <dhuard@localhost>2007-12-13 19:24:43 +0000
commitdd955bdb391b4dfe8922ce5a563173399df963a9 (patch)
tree65eda0f31090e5da8006423771c1bd2326cd2f3c /numpy/core/numeric.py
parent8e6f0852f2bd3c920edd67cc33316d84dda71376 (diff)
downloadnumpy-dd955bdb391b4dfe8922ce5a563173399df963a9.tar.gz
Fixed binary_repr to make sure that evaluation at 0 returns a string of length width.
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 59d2169d0..b2f141312 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -565,7 +565,7 @@ def binary_repr(num, width=None):
# replace num with its 2-complement
num = 2**width + num
elif num == 0:
- return '0'
+ return '0'*(width or 1)
ostr = hex(num)
bin = ''.join([_lkup[ch] for ch in ostr[2:]])
bin = bin.lstrip('0')