- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is Excess-3 Code?
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.
Representation of Excess-3 Code
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:
- Find the decimal equivalent of the given binary number.
- Add +3 to each digit of decimal number.
- Convert the newly obtained decimal number back to binary number to get required excess-3 equivalent.
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.
Converting into Binary Coded Decimal (BCD) codes
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.
Advantages of Excess-3 Codes
These are following advantages of Excess-3 codes,
- These are unweighted binary decimal codes.
- These are self-complementary codes.
- These use biased representation.
- The codes 0000 and 1111 are not used for any digit which is an advantage for memory organization as these codes can cause fault in transmission line.
- It has no limitation, and it considerably simplifies arithmetic operations.
- 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.
- What are the problems created due to excess calcium?
- What is Gray code?
- What is Polynomial Code?
- What is Code Division Multiplexing?
- What is Intermediate Code Generation?
- What is Three Address Code?
- Understanding Code Reuse and Modularity in Python 3
- What is unmanaged code in C#?
- What is tier-3 architecture in DBMS?
- What is unsafe/unmanaged code in C#?
- What is a managed code in C#?
- What is types of Intermediate Code Representation?
- What is type 3 grammar? Explain its properties
- What is Implementation of Three Address Code Statements?
- What is difference between selenium 2 and selenium 3?