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 serhiy.storchaka
Recipients John Belmonte, eric.smith, mark.dickinson, serhiy.storchaka, steven.daprano
Date 2021-12-07.09:54:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Well, it makes sense for negative zero produced by rounding.

But if we add a special support for this case, it would be useful to have some control on the type of rounding. Currently floats are rounded to the nearest decimal number, but in some cases it would be better to round up, down, toward zero or infinity (seed for example issue44884).

You can round explicitly before formatting, but this solution is also applicable for this issue:

>>> '%5.1f' % (round(-.00001, 1) + 0.0)
'  0.0'
Date User Action Args
2021-12-07 09:54:42serhiy.storchakasetrecipients: + serhiy.storchaka, mark.dickinson, eric.smith, steven.daprano, John Belmonte
2021-12-07 09:54:42serhiy.storchakasetmessageid: <>
2021-12-07 09:54:42serhiy.storchakalinkissue45995 messages
2021-12-07 09:54:42serhiy.storchakacreate