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 mark.dickinson
Recipients William McIlhagga, mark.dickinson
Date 2016-11-16.21:37:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479332230.73.0.669477266522.issue28717@psf.upfronthosting.co.za>
In-reply-to
Content
You don't say why you think this behaviour is wrong, or what you'd expect to see instead.

Nevertheless, this behaviour is by design: the code `'%.1f' % x` rounds `x` to the nearest one-digit-after-the-point decimal number, and returns a string representation of that number. In the case `x=0.25`, there is no single nearest number: `0.2` and `0.3` are equally close to `0.25`, so a choice between the two has to be made. In keeping with many other languages, Python chooses the value with even last digit. (The original behaviour is inherited from the typical behaviour of the standard library strtod or dtoa functions in C.)
History
Date User Action Args
2016-11-16 21:37:10mark.dickinsonsetrecipients: + mark.dickinson, William McIlhagga
2016-11-16 21:37:10mark.dickinsonsetmessageid: <1479332230.73.0.669477266522.issue28717@psf.upfronthosting.co.za>
2016-11-16 21:37:10mark.dickinsonlinkissue28717 messages
2016-11-16 21:37:10mark.dickinsoncreate