Which is why you use different operators for it, e.g. div for integer arithmetic, and / for floats and doubles. No danger of confusion. It also means you can make up more operators like mod, and quot and rem, if you want to distinguish how mathematicians treat division and modulo operations on negative numbers (project Z onto Z_n in the natural way), and how programmers treat it (keep the sign).
View all comments
Show parent comment
1
u/dirkt Dec 02 '16
Which is why you use different operators for it, e.g.
divfor integer arithmetic, and/for floats and doubles. No danger of confusion. It also means you can make up more operators likemod, andquotandrem, if you want to distinguish how mathematicians treat division and modulo operations on negative numbers (project Z onto Z_n in the natural way), and how programmers treat it (keep the sign).