Olli <mrblueskie...@gmail.com> added the comment:

Just because incorrect results are documented, that doesn't mean the current 
implementation could not be improved. 

More over, Python 2.7.16 on the same machine produces expected results:

Python 2.7.16 (default, Dec 21 2020, 23:00:36) 
[GCC Apple LLVM 12.0.0 (clang-1200.0.30.4) [+internal-os, ptrauth-isa=sign+stri 
on darwin

>>> for i in range(0, 10):
...     i = float(i) / 2
...     print i, '->', round(i)
... 
0.0 -> 0.0
0.5 -> 1.0
1.0 -> 1.0
1.5 -> 2.0
2.0 -> 2.0
2.5 -> 3.0
3.0 -> 3.0
3.5 -> 4.0
4.0 -> 4.0
4.5 -> 5.0

While exactly same code on Python 3.9.1 on same platform:

Python 3.9.1 (default, Feb  3 2021, 07:38:02) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin

>>> for i in range(0, 10):
...     i = float(i) / 2
...     print(i, '->', round(i))
... 
0.0 -> 0
0.5 -> 0
1.0 -> 1
1.5 -> 2
2.0 -> 2
2.5 -> 2
3.0 -> 3
3.5 -> 4
4.0 -> 4
4.5 -> 4

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43903>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to