Excess-3 code, also known as XS-3, is a self-complementary binary-coded decimal (BCD) code and numeral system. It is a biased representation and is particularly significant for arithmetic operations as it overcomes shortcomings encountered while using 8421 BCD code to add two decimal digits whose sum exceeds 9. The key features of excess-3 code are:
-
Representation: To obtain excess-3 codes, 3 is added to each decimal digit, and then it can be represented using a 4-bit binary number for each digit.
-
Arithmetic: Excess-3 arithmetic uses different algorithms than normal non-biased BCD or binary positional system numbers. After adding two excess-3 digits, the raw sum is excess-6. For instance, after adding 1 (0100 in excess-3) and 2 (0101 in excess-3), the sum looks like 6 (1001 in excess-3) instead of 3 (0110 in excess-3).
-
Self-complementing: Excess-3 codes are self-complementary, meaning that the 1s complement of the coded number yields the 9s complement of the number itself.
Excess-3 code was used on some older computers as well as in cash registers and hand-held portable electronic calculators of the 1970s, among other uses. The excess-3 code for a decimal number can be obtained in the same manner as BCD except that 3 is added to each decimal digit before encoding it in binary.