The excess-3 code (or XS3) is a non-weighted code used to express code used to express decimal numbers. It is a self-complementary binary coded decimal (BCD) code and numerical system which has biased representation. It is particularly significant for arithmetic operations as it overcomes shortcoming encountered while using 8421 BCD code to add two decimal digits whose sum exceeds 9. Excess-3 arithmetic uses different algorithm than normal non-biased BCD or binary positional number system.
Excess-3 codes are unweighted and can be obtained by adding 3 to each decimal digit then it can be represented by using 4 bit binary number for each digit. An Excess-3 equivalent of a given binary binary number is obtained using the following steps:
You can add 0011 to each four-bit group in binary coded decimal number (BCD) to get desired excess-3 equivalent.
These are following excess-3 codes for decimal digits −
|Decimal Digit||BCD Code||Excess-3 Code|
The codes 0000 and 1111 are not used for any digit.
Example-1 −Convert decimal number 23 to Excess-3 code.
So, according to excess-3 code we need to add 3 to both digit in the decimal number then convert into 4-bit binary number for result of each digit. Therefore,
= 23+33=56 =0101 0110 which is required excess-3 code for given decimal number 23.
Example-2 −Convert decimal number 15.46 into Excess-3 code.
According to excess-3 code we need to add 3 to both digit in the decimal number then convert into 4-bit binary number for result of each digit. Therefore,
= 15.46+33.33=48.79 =0100 1000.0111 1001 which is required excess-3 code for given decimal number 15.46.
One should note that to given Excess-3 code, the equivalent decimal number can be determined by splitting number into 4-bit group starting from least significant for integer part and from leftmost digit for fractional part. Then subtract 0011 (=3) from each four-bit group that will be binary decimal digit (BCD) form of that number. Now you can also convert this BCD code into decimal number by converting each 4-bit group into decimal digit.
Example − Convert Excess-3 code 1001001 into BCD and decimal number.
So, grouping 4-bit for each group, i.e., 0100 1001 and subtract 0011 0011 from given number. Therefore,
= 0100 1001 -0011 0011 =0001 0110
So, binary coded decimal number is 0001 0110 and decimal number will be 16.
Excess-3 code is non-weighted and self complementary code. A self complementary binary codes are always compliment themselves. The complement of a binary number can be obtained from that number by replacing 0’s with 1’s and 1’s with 0’s. The sum of binary number and its complement is always equal to decimal 9. In other words, the 1’s complement of an excess-3 code is the excess-3 code for the 9’s complement of the corresponding decimal number.
For example, the excess-3 code for decimal number 5 is 1000 and 1’s complement of 1000 is 0111, which is excess-3 code for decimal number 4, and it is 9’s complement of number 5.
These are following advantages of Excess-3 codes,