Implement a complete set of integer division operator pairs.
authorTaylor R Campbell <campbell@mumble.net>
Fri, 19 Nov 2010 05:02:58 +0000 (05:02 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Fri, 19 Nov 2010 05:02:58 +0000 (05:02 +0000)
commite17a939d40dd799435f9d6e03ce17b8288d3638f
treeaf6d7dc10d7bc80a1b4f391c5eee84dd86b37fe2
parentb95cfcd069825ac537b3f59abeae8dd9fe2ea078
Implement a complete set of integer division operator pairs.

Given a numerator n and a denominator d, each operator pair computes
an integral quotient q and the induced remainder r = n - d q such
that |r| < |d|.  There are five pairs: ceiling, euclidean, floor,
round, and truncate.  Ceiling, floor, round, and truncate compute the
rounded quotient as their names suggest.  Euclidean division is floor
division for positive denominators, and ceiling division for negative
denominators, so that it exhibits the stronger property 0 <= r < |d|.
src/runtime/division.scm [new file with mode: 0644]
src/runtime/runtime.pkg
tests/runtime/test-division.scm [new file with mode: 0644]