[issue3024] Integer conversion inconsistent
Martin v. Löwis
report at bugs.python.org
Mon Jun 2 00:49:54 CEST 2008
Martin v. Löwis <martin at v.loewis.de> added the comment:
I see. There is no such thing as a "correct" conversion from real
numbers to integer numbers. Instead, there are various approaches,
called "truncating", "rounding", "flooring", and "ceiling". Python's
default conversion is truncation, and it is consistent in doing so:
int(x) will return the nearest integer between 0 and x.
If you want rounding, use the round builtin.
----------
resolution: -> invalid
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3024>
_______________________________________
More information about the Python-bugs-list
mailing list