[issue5686] Float formatting with no type code produces incorrect output for exponential notation

Eric Smith report at bugs.python.org
Sat Apr 4 14:20:17 CEST 2009


New submission from Eric Smith <eric at trueblade.com>:

If no format specifier is supplied to a float, it's supposed to work
like 'g', but with at least one digit after the decimal. This works for
non-exponential notation:

>>> format(1., '')
'1.0'
>>> format(1., 'g')
'1'

But for exponential notation, it does not:
>>> format(1e200, '')
'1e+200'
>>> 
>>> format(1e200, 'g')
'1e+200'

----------
assignee: eric.smith
components: Interpreter Core
messages: 85386
nosy: eric.smith
severity: normal
status: open
title: Float formatting with no type code produces incorrect output for exponential notation
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5686>
_______________________________________


More information about the Python-bugs-list mailing list