[issue36622] Inconsistent exponent notation formatting

Sep Dehpour report at bugs.python.org
Fri Apr 12 20:36:55 EDT 2019


New submission from Sep Dehpour <sep+py at zepworks.com>:

Floats and Decimals have inconsistent exponent notation formatting:

>>> '{:.5e}'.format(Decimal('2.0001'))
'2.00010e+0'
>>> '{:.5e}'.format(2.0001)
'2.00010e+00'

This is causing issues for us since we use the scientific notation formatted string of numbers to compare them. Between decimals and floats, one produces '+0' while the other one produces '+00'

----------
messages: 340136
nosy: seperman
priority: normal
severity: normal
status: open
title: Inconsistent exponent notation formatting
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36622>
_______________________________________


More information about the Python-bugs-list mailing list