Machine-sized Integers
The SingleInteger is intended to
provide support in Axiom for machine integer arithmetic. It is generally
much faster than (bignum) Integer arithmetic
but suffers from a limited range of values. Since Axiom can be implemented
on top of various dialects of Lisp, the actual representation of small
integers may not correspond exactly to the host machines integer
representation.
You can discover the minimum and maximum values in your implementation by
using min and max
To avoid confusion with Integer, which is
the default type for integers, you usually need to work with declared
variables (see Declarations).
or use package calling (see
Package Calling and Target Types).
You can add, multiply, and subtract
SingleInteger objects, and ask for the
greatest common divisor
(gcd).
The least common multiple
(lcm) is also available.
Operations
mulmod,
addmod,
submod, and
invmod
are similar -- they provide arithmetic modulo a given small integer.
Here is 5*6 mod 13.
To reduce a small integer modulo a prime, use
positiveRemainder
Operations And,
Or,
xor,
and Not
provide bit level operations on small integers.
Use shift(int,numToShift) to shift bits, where int is shifted left if
numToShift is positive, right if negative.
Many other operations are available for small integers, including many of
those provided for Integer.
To see other operations use the system command