[New-bugs-announce] [issue21179] Rounding half to even
Clinton Curry
report at bugs.python.org
Tue Apr 8 12:58:58 CEST 2014
New submission from Clinton Curry:
In the current Python 2.7 documentation, Section 5.4
https://docs.python.org/2.7/library/stdtypes.html
the result of the round function is described as "x rounded to n digits, rounding half to even. If n is omitted, it defaults to 0." However, my observed behavior (Python 2.7.4 (default, Apr 6 2013, 19:55:15) [MSC v.1500 64 bit (AMD64)] on win32) does not round half to even, but rounds half away from zero.
>>> round(1.5)
2.0
>>> round(2.5)
3.0
>>> round(-1.5)
-2.0
>>> round(-2.5)
-3.0
I observe similar behavior on other platforms.
----------
assignee: docs at python
components: Documentation
messages: 215753
nosy: Clinton.Curry, docs at python, eric.araujo, ezio.melotti, georg.brandl
priority: normal
severity: normal
status: open
title: Rounding half to even
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21179>
_______________________________________
More information about the New-bugs-announce
mailing list