Where is the correct round() method?

josh logan dear.jay.logan at gmail.com
Mon Jul 28 02:52:09 CEST 2008


On Jul 27, 8:45 pm, pigmartian <scottp... at comcast.net> wrote:
> it could be that 3.0 is using "banker's rounding" --- rounding to the
> even digit.  the idea behind it behind it being to reduce error
> accumulation when working with large sets of values.
>
> > Works for me on Python 2.5 on Linux running on "Intel(R) Core(TM)2 Duo
> > CPU".  What system are you on?
>
> > It could be that 2.5 is really 2.49999... which would round down to 2,
> > but on any modern CPU (using IEEE floating point), 2.5 should be
> > representable exactly.
>
>

That's exactly what's happening, pigmartian. Thank you for explaining
the reasoning behind this change.
So am I relegated to building my own round() function that behaves
like the original function? Or did they move the functionality to a
new method somewhere for backwards-compatibility?



More information about the Python-list mailing list