Division and Modulus for Computer Scientists

There exist many definitions of the div and mod functions in computer science literature and programming languages. We briefly review the most common definitions (truncated division, Knuth's floored division, etc.) and discuss the rare, but mathematically elegant, Euclidean division. We also give an algorithm for the Euclidean div and mod functions and prove it correct with respect to Euclid's theorem.

divmodnote.pdf
PDF file
divmodnote-letter.pdf
PDF file

Details

TypeMiscellaneous
Book titleShort note about division definitions in programming languages
> Publications > Division and Modulus for Computer Scientists