One machine word can contain a SINGLE PRECISION
INTEGER in the range
.
To represent integers outside of this range, so called
MULTIPRECISION INTEGER, we use arrays of
-bit words.
To be precise we consider the
-ary (or radix
)
expansion of a nonzero integer:
|
(33) |
where
- every
is a digit in
the
-ary expansion of
,
-
determines the sign of
,
-
is the number of
-digits in
the
-ary expansion of
,
-
.
Then the integer
with
-digits
can be represented by an array (of
-bit words)
with length
since we need
- one word for
and
- one word for
The reasonable UNIT OPERATION for integers
is the the WORD OPERATION.
One can easily check that
- the ADDITION of two integers with
at most
-digits requires
word operations
- the MULTIPLICATION of two integers with
at most
-digits requires
word operations.
Marc Moreno Maza
2008-01-07