Canonical signed digit


In computing canonical-signed-digit is a special manner for encoding a value in a signed-digit representation, which itself is non-unique representation and allows one number to be represented in many ways. Probability of digit being zero is close to 66% and leads to efficient implementations of add/subtract networks in hardwired digital signal processing.
The representation uses a sequence of one or more of the symbols, -1, 0, +1 with each position possibly representing the addition or subtraction of a power of 2. For instance 23 is represented as +0-00-, which expands to or

Implementation

CSD is obtained by transforming every sequence of zero followed by ones into + followed by zeros and the least significant bit by -.
As an example: the number 7 has a two's complement representation 0111
into +00-