![]() | Library Documentation | Structures | Signatures | Identifiers | Packages | About |
INT_INF (basis)Operations on arbitrarily large integers.
The optional IntInf structure is one of the possible implementations of the INTEGER interface. In addition to the INTEGER operations, it provides some operations useful for programming with arbitrarily large integers. Operations in IntInf that return a value of type IntInf.int should never raise the Overflow exception. Note that, as it extends the INTEGER interface, IntInf defines a type int. Any use of this type below, unmodified by a structure, refers to the local type int defined in IntInf.structure IntInf : INT_INF (basis)
signature INT_INF =
sig
include INTEGER
val divMod : int * int -> int * int
val quotRem : int * int -> int * int
val pow : int * Int.int -> int
val log2 : int -> Int.int
val orb : int * int -> int
val xorb : int * int -> int
val andb : int * int -> int
val notb : int -> int
val << : int * Word.word -> int
val ~>> : int * Word.word -> int
end where type int = intinf
i pow(i,j)
0 Raise Div
|i| = 1 i(j)
|i| > 1 0
andb(i, bit) = 0 if i >= 0
andb(i, bit) = bit if i < 0
The rationale is that it is useful to have a module providing bit-wise
operations on an unbounded domain. Such a module can serve as the
basis for implementing sets or bit-vectors. These operations seemed to
naturally fit into the specification of the IntInf module, rather than
require an additional WordInf structure.