Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
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' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45995> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com