Next: , Previous: Modular Arithmetic, Up: Mathematical Packages


5.3 Irrational Integer Functions

(require 'math-integer)

— Function: integer-expt n1 n2

Returns n1 raised to the power n2 if that result is an exact integer; otherwise signals an error.

(integer-expt 0 n2)

returns 1 for n2 equal to 0; returns 0 for positive integer n2; signals an error otherwise.

— Function: integer-log base k

Returns the largest exact integer whose power of base is less than or equal to k. If base or k is not a positive exact integer, then integer-log signals an error.

— Function: integer-sqrt k

For non-negative integer k returns the largest integer whose square is less than or equal to k; otherwise signals an error.

— Function: quotient n1 n2
— Function: remainder n1 n2
— Function: modulo n1 n2

are redefined so that they accept only exact-integer arguments.

— Function: round-quotient n1 n2

Returns the quotient of n1 and n2 rounded toward even.

          (quotient 3 2)        ⇒ 1
          (round-quotient 3 2)  ⇒ 2