Residue Number System: Dr. Arunachalam V Associate Professor, SENSE
Residue Number System: Dr. Arunachalam V Associate Professor, SENSE
Dr. Arunachalam V
Associate Professor, SENSE
Why RNS ?
• By converting arithmetic on large numbers to arithmetic on a collection of
smaller numbers, residue number system (RNS) representations produce
significant speedup for some classes of arithmetic -intensive algorithms in
signal processing applications.
• RNS arithmetic is a valuable tool for theoretical studies of limits of fast
arithmetic.
Introduction
• What number has reminders of 2, 3 and 2 when divided by the numbers 7,
5 and 3 respectively?
105x + 23 (23, 128, 233, …)
• The puzzle essentially asks us to convert the coded representation (2|3|2) of
a RNS, based on the moduli (7|5|3) in to a standard decimal format.
Representation of a number in RNS
• In a RNS, a number is represented by the list of its residues with respect
to k pairwise relatively prime moduli > > ∙ ∙ ∙> > .
• The residue of with respect to the ith modulus is akin to digit and
the entire k-residue representation of can be viewed as a k-digit number,
where the digit set for the ith position is [0, ].
• Notationally, = =
• Also specify the RNS representation of by enclosing the list of residues,
or digits, in parentheses.
• For example = 2|3|2 | | represents the puzzle by Sun Tzu.
• The list of moduli can be deleted from the subscript when we have agreed
on a default set.
• In many of the examples, we use the following RNS is assumed:
RNS (8|7|5|3)
Dynamic range (M)
• It is the product of the k-pairwise relatively prime moduli and it describes
the number of different representable values in this range = ×∙∙∙
× ×
• For example, M for RNS(8|7|5|3) is 8 × 7 × 5 × 3 = 840 ,
• Because of the equality, − = − the 840 available values can
be used to represent numbers 0 through 839, -420 through +419, or any
other interval of 840 consecutive integers.
• In effect, negative numbers are represented using a complement system
with the complementation constant M.
Some examples for RNS (8|7|5|3)
Complementing a RNS number