[docs] (no subject)

Artur Kowalczyk ojkoorde at gmail.com
Tue Oct 31 05:31:58 EDT 2017


https://docs.python.org/3/whatsnew/2.2.html#pep-238-changing-the-division-operator

Above documentation is not correct in this sentence:

*Currently Python’s division operator, /, behaves like C’s division
operator when presented with two integer arguments: it returns an integer
result that’s truncated down when there would be a fractional part.*

Even below in the same paragraph it says sth different.

In C/C++ result of integer division is truncated  (ie. truncated toward
zero). In python / operator when given integer operands performs floor
division. Trunc operation is equal to ceil for negative numbers and floor
for positive. It is not the same as floor for al reals.

in Python 2: -7/3=-3 which is floor of -2.(3) not trunc

So Python's integer division is far from being the same as in C or C++.

Regards,
Artur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20171031/b35a2ff7/attachment.html>


More information about the docs mailing list