Amaury Forgeot d'Arc added the comment:

Your function is not better:

>>> print my_round(s,2)
1.41
>>> my_round(s,2)
1.4099999999999999

print uses str(), and restricts itself to 12 significant digits.
the direct call uses repr(), and display the most precise number.

The problem is not in the computation, but is inherent to the 'float'
type which cannot represent 1.41 exactly. Please carefully read the faq
entry above.

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1565>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to