Multiple value division

floor, truncate, and related functions return multiple values for division-related operations: the quotient, and the remainder. There are several situations where both values are useful.

For example, if you have a vector of octet values and you want to find the value of a particular bit, you can use something like this:

(defun bit-ref (octet-vector index)
  (multiple-value-bind (octet-index bit-index)
      (truncate index 8)
    (ldb (byte 1 bit-index)
         (aref octet-vector octet-index))))

Another use is copying a known amount of data in fixed-size chunks, e.g. when copying a file somewhere. The quotient represents the number of full chunks occupied by the data, and the remainder is the count of elements in the final partial chunk.