[issue3404] wrong precision in float formatting

Hagen Fürstenau report at bugs.python.org
Fri Jul 18 12:40:27 CEST 2008


New submission from Hagen Fürstenau <hfuerstenau at gmx.net>:

This seems to be wrong:

>>> "{0:.2}".format(1.2345)
'1.2'

The same happens for format specifiers "g" and "n", but not for "f":

>>> "{0:.2f}".format(1.2345)
'1.23'

With empty format specifier it can even get really wrong:

>>> "{0:.1}".format(1.2345)
'1.0'

----------
components: Interpreter Core
messages: 69947
nosy: hagen
severity: normal
status: open
title: wrong precision in float formatting
type: behavior
versions: Python 2.6, Python 3.0

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


More information about the Python-bugs-list mailing list