[docs] (no subject)
ojkoorde at gmail.com
Tue Oct 31 05:31:58 EDT 2017
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++.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the docs