python - What suppose to be the answer to 6/-132? -


this question has answer here:

in python, 6/-132 gets answer of -1, should 0?

what's rules behind it?

python floors result, means 1/2 floors zero, 1/-2 floors -1. different c, 'truncates toward 0'. afaik, languages follow c. python uses different rules keep division 'in sync' modulo. article job of explaining.

http://python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html


Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -