summaryrefslogtreecommitdiff
path: root/representer.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2018-06-13 08:44:03 +0200
committerAnthon van der Neut <anthon@mnt.org>2018-06-13 08:44:03 +0200
commite9ee46dea6d1e1fdc19b42914696aba8a985fc31 (patch)
tree2374982d5de6a3db0f459a581796982e4278a18a /representer.py
parentabb4161983a5d93149e01e590362510e59fc3c6e (diff)
parent13a883ccbdcba12f942c134aceb9e38fe70f372f (diff)
downloadruamel.yaml-e9ee46dea6d1e1fdc19b42914696aba8a985fc31.tar.gz
Merge PR29, fixes issue #195
*When this change indeed resolves your problem, please **Close** this issue*. *(You can do so usingthe WorkFlow pull-down (close to the top right of this page)*
Diffstat (limited to 'representer.py')
-rw-r--r--representer.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/representer.py b/representer.py
index 25e53b9..43f2c06 100644
--- a/representer.py
+++ b/representer.py
@@ -782,7 +782,9 @@ class RoundTripRepresenter(SafeRepresenter):
value += u'0'
else:
# exponent
- m, es = u'{:{}e}'.format(data, data._width).split('e')
+ m, es = u'{:{}.{}e}'.format(
+ data, data._width, data._width - data._prec + (1 if data._m_sign else 0)
+ ).split('e')
w = data._width if data._prec > 0 else (data._width + 1)
if data < 0:
w += 1