August 13th, 2024

Division and Modulus for Computer Scientists (2003)

The document reviews various definitions of division and modulus functions in programming, including truncated, floored, and Euclidean division, providing an algorithm and proof of correctness for Euclidean division.

Read original articleLink Icon
Division and Modulus for Computer Scientists (2003)

The document discusses various definitions of division and modulus functions in programming languages, focusing on the common and less common approaches. It reviews truncated division, Knuth’s floored division, and the mathematically elegant Euclidean division. The author, Daan Leijen, provides an algorithm for the Euclidean division and modulus functions, along with a proof of its correctness based on Euclid’s theorem. This exploration highlights the diversity in how division is implemented across different programming languages and the theoretical underpinnings that support these definitions.

- The document reviews multiple definitions of division and modulus in programming.

- It discusses common methods like truncated and floored division, as well as Euclidean division.

- An algorithm for Euclidean division and modulus is provided, with a proof of correctness.

- The work emphasizes the theoretical foundations of division in computer science.

Link Icon 1 comments