Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Modulo Operator | Better HN
Modulo Operator
(offbeat.cc)
2 points · by
susam
· 5y ago · 1 comment
Comments
[–]
danbst
5y ago
Both are correct from math POV, but they differ in how "integer division" works.
Python floors `7 // -5` to -2, C rounds `7 / (-5)` to -1.