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 dingo
Recipients dingo
Date 2008-12-20.16:42:34
SpamBayes Score 4.976323e-05
Marked as misclassified No
Message-id <1229791357.03.0.0672690211922.issue4707@psf.upfronthosting.co.za>
In-reply-to
Content
I've been playing around with the newly released Python 3.0, and I'm a
bit confused about the built-in round()-function. To sum it up in a
single example:

Python 3.0 (r30:67503, Dec  7 2008, 04:54:04)
[GCC 4.3.2] on linux2
>>> round(25, -1)
30.0

I had expected the result to be the integer 20, because:

1. The documentation on built-in functions says: "values are rounded to
the closest multiple of 10 to the power minus n; if two multiples are
equally close, rounding is done toward the even choice"

2. Both help(round) and the documentation on built-in functions claim
that, if two arguments are given, the return value will be of the same
type as the first argument.

Is this unintended behaviour, or am I missing something?
History
Date User Action Args
2008-12-20 16:42:37dingosetrecipients: + dingo
2008-12-20 16:42:37dingosetmessageid: <1229791357.03.0.0672690211922.issue4707@psf.upfronthosting.co.za>
2008-12-20 16:42:35dingolinkissue4707 messages
2008-12-20 16:42:34dingocreate