chickadee » numbers » truncate-quotient

floor/ A Bprocedure
floor-quotient A Bprocedure
floor-remainder A Bprocedure
truncate/ A Bprocedure
truncate-quotient A Bprocedure
truncate-remainder A Bprocedure

These procedures are from R7RS.

The floor/ and truncate/ versions return two values: the quotient and remainder obtained after dividing A by B. The -quotient and -remainder procedures simply return only the corresponding value of the "full" computation.

The difference is in how the values are derived for negative values.

If both values are desired, the two-value versions are recommended, as they perform the computation only once.

All the procedures compute a quotient q and remainder r such that A = nq + r. The remainder is determined by the choice for q, through the relation r = A - nq. The floor procedures compute q = floor(A/B) and the truncate procedures compute q = truncate(A/B).

See Riastradh's proposal for Division operators in Scheme for a full explanation of the intricacies of these procedures.