On Sun, 20 Apr 2014 15:38:03 +0300, Jussi Piitulainen wrote: > Steven D'Aprano writes: > >> It doesn't round, it truncates. >> >> [steve@ando ~]$ python2.7 -c "print round(799.0/100)" 8.0 >> [steve@ando ~]$ python2.7 -c "print 799/100" 7 > > Seems it floors rather than truncates: > > $ python2.7 -c "from math import trunc;print trunc(799./-100)" -7 > $ python2.7 -c "from math import floor;print floor(799./-100)" -8.0 > $ python2.7 -c "print 799/-100" > -8 > > $ python3.2 -c "print(799//-100)" > -8
Ah yes, so it does. Sorry for the confusion. This has been reported as a bug at least twice, but it is actually working as intended. // floors, not truncates towards zero. http://bugs.python.org/issue19446 http://bugs.python.org/issue19574 -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list