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.

Author sk1d
Recipients sk1d
Date 2018-02-08.02:08:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1518055716.96.0.467229070634.issue32790@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation starts the the string format parameter 'g':

General format. For a given precision p >= 1, this rounds the number to **p significant digits** and then formats the result in either fixed-point format or in scientific notation, depending on its magnitude.

I think the behavior of format is inconsistent here:
>>> format(0.1949, '.2g')
returns '0.19' as expected but
>>> format(0.1950, '.2g')
returns '0.2' instead of '0.20'

This behavior for float is in my opinion the correct one here
>>> format(0.1950, '.2f')
returns '0.20'
History
Date User Action Args
2018-02-08 02:08:37sk1dsetrecipients: + sk1d
2018-02-08 02:08:36sk1dsetmessageid: <1518055716.96.0.467229070634.issue32790@psf.upfronthosting.co.za>
2018-02-08 02:08:36sk1dlinkissue32790 messages
2018-02-08 02:08:35sk1dcreate