;;; Procedure: ;;; remainder ;;; Parameters: ;;; dividend, an integer [verified] ;;; divisor, an integer [verified] ;;; Purpose: ;;; Compute the whole remainder of dividing dividend by divisor. ;;; Produces: ;;; rem, an integer ;;; Preconditions: ;;; divisor != 0 [verified] ;;; Postconditions: ;;; Exists integer, quotient, such that ;;; quotient*divisor + remainder = dividend ;;; abs(quotient*divisor) <= abs(dividend) ;;; abs(dividend) < abs((quotient+1)* divisor) ;;; Informally: "The quotient is the biggest number such that ;;; when you multiply it by divisor, the result is less than ;;; dividend." ;;; Procedure: ;;; modulo ;;; Parameters: ;;; val, an integer [verified] ;;; base, an integer [verified] ;;; Purpose: ;;; Computes val mod base. ;;; Produces: ;;; result, an integer ;;; Preconditions: ;;; base is non 0. ;;; Postconditions: ;;; If base > 0, 0 <= result < base. ;;; If base < 0, base < result <= 0. ;;; Exists integer, quotient, such that ;;; quotient*base + result = val