diff options
author | Allan Haldane <allan.haldane@gmail.com> | 2017-12-29 18:24:19 -0500 |
---|---|---|
committer | Allan Haldane <allan.haldane@gmail.com> | 2018-01-28 19:18:49 -0500 |
commit | 652892bf387344db6cd729fd5acbe4ac0c15b69c (patch) | |
tree | bd32a4647471982c4db96336fad391a929338e1a /numpy/core/arrayprint.py | |
parent | 2e4cd0d763265908d1143fcb5ca4ba8e3555a333 (diff) | |
download | numpy-652892bf387344db6cd729fd5acbe4ac0c15b69c.tar.gz |
BUG: repr of negative zeros sometimes has an extra space
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r-- | numpy/core/arrayprint.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index aad80dd7a..472318098 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -879,8 +879,7 @@ class FloatingFormat(object): for x in finite_vals) int_part, frac_part = zip(*(s.split('.') for s in strs)) if self._legacy == '1.13': - self.pad_left = 1 + max(len(s.lstrip('-').lstrip('+')) - for s in int_part) + self.pad_left = 1 + max(len(s.lstrip('-+')) for s in int_part) else: self.pad_left = max(len(s) for s in int_part) self.pad_right = max(len(s) for s in frac_part) @@ -896,8 +895,8 @@ class FloatingFormat(object): if self._legacy != '1.13': # account for sign = ' ' by adding one to pad_left - if all(finite_vals >= 0) and self.sign == ' ': - self.pad_left += 1 + if self.sign == ' ' and not any(np.signbit(finite_vals)): + self.pad_left += 1 # if there are non-finite values, may need to increase pad_left if data.size != finite_vals.size: |