chickadee » srfi-141 » ceiling-remainder

ceiling-remainder numerator denominatorprocedure

Satisfies

   q = ceiling(n/d)

Thus r is negative iff d is non-negative.

If denominator is the number of units in a block, and numerator is some number of units, then (ceiling-quotient numerator denominator) gives the number of blocks needed to cover numerator units. For example, denominator might be the number of bytes in a disk sector, and numerator the number of bytes in a file; then the quotient is the number of disk sectors needed to store the contents of the file. For another example, denominator might be the number of octets in the output of a cryptographic hash function, and numerator the number of octets desired in a key for a symmetric cipher, to be derived using the cryptographic hash function; then the quotient is the number of hash values needed to concatenate to make a key.