[Python-ideas] Deprecate the round builtin

Mark Dickinson dickinsm at gmail.com
Wed Sep 26 22:02:39 CEST 2012

On Wed, Sep 26, 2012 at 8:36 PM, M.-A. Lemburg <mal at egenix.com> wrote:
> It's actually quite common in finance and time calculations to
> round to the nearest say basis point, cent or say micro second
> in calculations

That's exactly where the problems creep in, though.  Naive users
expect rounding to give 'correct' results for decimal halfway cases,
and then are surprised when it doesn't.

>>> round(2.675, 2)

So you end up explaining again and again that computing binary
approximations to decimal rounds of binary approximations of decimal
halfway cases is a bad idea.


More information about the Python-ideas mailing list