summaryrefslogtreecommitdiff
path: root/numpy/core/arrayprint.py
diff options
context:
space:
mode:
authorwrwrwr <git@wr.waw.pl>2016-10-01 21:44:38 +0200
committerwrwrwr <git@wr.waw.pl>2016-10-07 14:26:40 +0200
commit65e1e0e4ba0909a45f410a24360e97568e2bb66a (patch)
tree6aa6548b7d96b10a1a235d8353239a33765f1237 /numpy/core/arrayprint.py
parent9914e603fa620aa7d3ae9576772eb50df4b799ef (diff)
downloadnumpy-65e1e0e4ba0909a45f410a24360e97568e2bb66a.tar.gz
BUG: Fix array printing with precision=0.
Values rounding to zero were formatted with negative precision.
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r--numpy/core/arrayprint.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
index b05082e9d..cd618d72a 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -626,9 +626,12 @@ class FloatFormat(object):
def _digits(x, precision, format):
- s = format % x
- z = s.rstrip('0')
- return precision - len(s) + len(z)
+ if precision > 0:
+ s = format % x
+ z = s.rstrip('0')
+ return precision - len(s) + len(z)
+ else:
+ return 0
class IntegerFormat(object):