Skip to main content

Excess-3 code with examples

Short answer

Excess-3 code represents each decimal digit as 4-bit binary of (digit+3). Example: decimal 39 becomes 3→0110, 9→1100, so (0110 1100) in XS-3. It is self-complementing and aids decimal arithmetic.

Explain Excess-3 code with suitable examples.

Excess-3 (XS-3) code is a non-weighted BCD code in which each decimal digit is coded as the 4-bit binary of (digit + 3). It was used in early computers and calculators because it makes decimal arithmetic easier.

Excess-3 table

DecimalBCD (8421)Excess-3
000000011
100010100
200100101
300110110
401000111
501011000
601101001
701111010
810001011
910011100

Codes 0000, 0001, 0010, 1101, 1110, 1111 are invalid (unused).

How to convert

Add 3 to each decimal digit separately, then write each result in 4-bit binary.

Example 1: (39)10(39)_{10}

  • 3 + 3 = 6 → 0110
  • 9 + 3 = 12 → 1100
  • (39)10=(0110 1100)XS−3(39)_{10} = (0110\ 1100)_{XS-3}

Example 2: (258)10(258)_{10}

  • 2 → 0101, 5 → 1000, 8 → 1011
  • (258)10=(0101 1000 1011)XS−3(258)_{10} = (0101\ 1000\ 1011)_{XS-3}

Properties

  1. Unweighted code: bit positions have no fixed weights.
  2. Self-complementing: the 9's complement of a digit is obtained by simply inverting all bits. For example, 4 = 0111; inverting gives 1000 = 5 in XS-3, and 9−4=59 - 4 = 5. This made subtraction simple in old machines.
  3. No all-zero code: every valid code has at least one 1, which helps detect a dead line.
  4. Easy addition: when two XS-3 digits are added, a carry occurs exactly when the decimal sum exceeds 9. Correction: if there is a carry, add 0011 to the digit; if no carry, subtract 0011.

Addition example: 4+54 + 5

  • 0111+1000=11110111 + 1000 = 1111, no carry
  • subtract 0011: 1111−0011=11001111 - 0011 = 1100 = 9 in XS-3

Excess-3 is therefore a convenient BCD code for decimal arithmetic, though it needs more bits than pure binary.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Digital Logic chapter 1 questions →