diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2016-10-07 10:04:49 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-07 10:04:49 -0500 |
commit | fda7484cb572c8e6b50173784cb1498aca03a4e5 (patch) | |
tree | c78f1166c7cb2797e9b854505f6c2adcc6688f2f /numpy/core/arrayprint.py | |
parent | fa214c1f75e6f1bfbb64eafa206049e3efe19763 (diff) | |
parent | 65e1e0e4ba0909a45f410a24360e97568e2bb66a (diff) | |
download | numpy-fda7484cb572c8e6b50173784cb1498aca03a4e5.tar.gz |
Merge pull request #8107 from wrwrwr/fix-precision-zero
BUG: Fix array printing with precision=0.
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r-- | numpy/core/arrayprint.py | 9 |
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): |