# Decimal Fixed-Point Representation

The representation of decimal numbers in registers is a function of the binary code used to represent a decimal digit. A 4-bit decimal code requires four flip-flops for each decimal digit. The representation of 4385 in BCD requires I6 flip-flops, four flip-flops for each digit. The number will be represented in a register with I6 flip-flops as follows:

OIOO 001 1 1000 0101

By representing numbers in decimal we are wasting a considerable amount of storage space since the number of bits needed to store a decimal number in a binary code is greater than the number of bits needed for its equivalent binary representation. Also, the circuits required to perform decimal arithmetic are more complex. However, there are some advantages in the use of decimal representation because computer input and output data are generated by people who use the decimal system. Some applications, such as business data processing, require small amounts of arithmetic computations compared to the amount required for input and output of decimal data. For this reason, some computers and all electronic calculators perform arithmetic operations directly with the decimal data (in a binary code) and thus eliminate the need for conversion to binary and back to decimal. Some computer systems have hardware for arithmetic calculations with both binary and decimal data.

The representation of signed decimal numbers in BCD is similar to the representation of signed numbers in binary. We can either use the familiar signed-magnitude system or the signed-complement system. The sign of a decimal number is usually represented with four bits to conform with the 4-bit code of the decimal digits. It is customary to designate a plus with four 0' s and a minus with the BCD equivalent of 9, which is 1001 .

The signed-magnitude system is difficult to use with computers. The signed-complement system can be either the 9's or the 10's complement, but the 10's complement is the one most often used. To obtain the 10' s complement of a BCD number, we first take the 9's complement and then add one to the least significant digit. The 9' s complement is calculated from the subtraction of each digit from 9.

The procedures developed for the signed-2's complement system apply also to the signed-10's complement system for decimal numbers. Addition is done by adding all digits, including the sign digit, and discarding the end carry. Obviously, this assumes that all negative numbers are in 10's complement form. Consider the addition ( +375) + ( -240) = + 135 done in the signed10's complement system.

0 375 (0000 0011 0111 0101)BCD

+9 760 (1001 0111 0110 OOOO)BCD

0 135 (0000 0001 001 1 0101)BCD

The 9 in the leftmost position of the second number indicates that the number is negative. 9760 is the 10's complement of 0240. The two numbers are added and the end carry is discarded to obtain + 135. Of course, the decimal numbers inside the computer must be in BCD, including the sign digits. The addition is done with BCD adders (see Fig. 10-18).

The subtraction of decimal numbers either unsigned or in the signed-10' s complement system is the same as in the binary case. Take the 10' s complement of the subtrahend and add it to the minuend. Many computers have special hardware to perform arithmetic calculations directly with decimal numbers in BCD. The user of the computer can specify by programmed instructions that the arithmetic operations be performed with decimal numbers directly without having to convert them to binary.

**Frequently Asked Questions**

## Recommended Posts:

- DATA TYPES
- NUMBER SYSTEM
- CONVERSION - INTRODUCTION
- OCTAL AND HEXADECIMAL NUMBER CONVERSION
- OCTAL AND HEXADECIMAL NUMBER CONVERSION -2
- Introduction to Decimal Representation
- ALPHANUMERIC REPRESENTATION
- Complements
- Complements -2
- Subtraction of Unsigned Numbers
- Subtraction of Unsigned Numbers-2
- Fixed-Point Representation
- Integer Representation
- Arithmetic Addition
- Binary Adder

**3/5**