This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008年07月18日 10:40 by hagen, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg69947 - (view) | Author: Hagen Fürstenau (hagen) | Date: 2008年07月18日 10:40 | |
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'
|
|||
| msg69948 - (view) | Author: Hagen Fürstenau (hagen) | Date: 2008年07月18日 10:54 | |
Just found it documented for the % operator: There precision is number of digits before and after decimal point for format "g". But then the documentation for 2.6 is wrong: "The precision is a decimal number indicating how many digits should be displayed after the decimal point for a floating point value." |
|||
| msg69949 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年07月18日 11:15 | |
Fixed docs in r65099. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:36 | admin | set | github: 47654 |
| 2008年07月18日 11:15:17 | georg.brandl | set | status: open -> closed resolution: fixed messages: + msg69949 |
| 2008年07月18日 10:54:22 | hagen | set | title: wrong precision in float formatting -> wrong precision in float formatting or doc error nosy: + georg.brandl messages: + msg69948 assignee: georg.brandl components: + Documentation type: behavior -> |
| 2008年07月18日 10:40:25 | hagen | create | |