[issue1565] round(x,y) doesn't behave as expected, round error

Shlomo Anglister report at bugs.python.org
Fri Dec 7 11:04:55 CET 2007


Shlomo Anglister added the comment:

>>> def my_round(n,i):
...     t = n * (10**i)
...     s = round(t)
...     r = s / (10**i)
...     return r
... 
>>> print my_round(s,2)
1.41

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1565>
__________________________________


More information about the Python-bugs-list mailing list