Introduction to Decimal Representation
The binary number system is the most natural system for a computer, but people are accustomed to the decimal system. One way to solve this conflict is to convert all input decimal numbers into binary numbers, let the computer perform all arithmetic operations in binary and then convert the binary results back to decimal for the human user to understand.However, it is also possible for the computer to perform arithmetic operations directly with decimal numbers provided they are placed in registers in a coded form.
Decimal numbers enter the computer usually as binary-coded alphanumeric characters. These codes, introduced later, may contain from six to eight bits for each decimal digit. When decimal numbers are used for internal arithmetic computations, they are converted to a binary code with four bits per digit.
A binary code is a group of n bits that assume up to 2" distinct combinations of 1's and D's with each combination representing one element of the set that is being coded. For example, a set of four elements can be coded by a 2-bit code with each element assigned one of the following bit combinations; 00, 01, 10, or 11. A set of eight elements requires a 3-bit code, a set of 16 elements requires a 4-bit code, and so on. A binary code will have some unassigned bit combinations if the number of elements in the set is not a multiple power of 2.
The 10 decimal digits form such a set. A binary code that distinguishes among 10 elements must contain at least four bits, but six combinations will remain unassigned. Numerous different codes can be obtained by arranging four bits in 10 distinct combinations. The bit assignment most commonly used for the decimal digits is the straight binary assigrunent listed in the first 10 entries of Table 3-3. This particular code is called binary-coded decimal and is commonly referred to by its abbreviation BCD.
It is very important to understand the difference between the conversion of decimal numbers into binary and the binary coding of decimal numbers. For example, when converted to a binary number, the decimal number 99 is represented by the string of bits 110001 1, but when represented in BCD, it becomes 1001 1001 .
The only difference between a decimal number represented by the familiar digit symbols 0, 1, 2, ... , 9 and the BCD symbols 0001, 0010, ... , 1001 is in the symbols used to represent the digits-the number itself is exactly the same. A few decimal numbers and their representation in BCD are listed in Table 3-3.
Frequently Asked Questions
- DATA TYPES
- NUMBER SYSTEM
- Other Decimal Codes
- Other Alphanumeric Codes
- Error Detection Codes
- Error Detection Codes-2
- Register Transfer Language
- Register Transfer Language -2
- Register Transfer
- Register Transfer -2
- Bus and Memory Transfers
- Bus and Memory Transfers -2
- Three-State Bus Buffers
- Memory Transfer
- Binary Adder