[issue4707] round() shows undocumented behaviour
Christian Taylor
report at bugs.python.org
Sat Dec 20 17:42:37 CET 2008
New submission from Christian Taylor <dingo at chello.at>:
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?
----------
components: Interpreter Core
messages: 78113
nosy: dingo
severity: normal
status: open
title: round() shows undocumented behaviour
type: behavior
versions: Python 3.0
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4707>
_______________________________________
More information about the Python-bugs-list
mailing list