Browse Prior Art Database

# Conversion of Number Representations

IP.com Disclosure Number: IPCOM000078273D
Original Publication Date: 1972-Dec-01
Included in the Prior Art Database: 2005-Feb-25
Document File: 3 page(s) / 77K

IBM

## Related People

Loevenbruck, AP: AUTHOR

## Abstract

There are many situations in which it is necessary to convert a representation of a number having a nonbinary base, where each element (digit if the number has base 10) is binary coded, into a pure binary representation. The most common occurrence is when a decimal number is represented in Binary-Coded Decimal (BCD), where each digit is represented by its binary equivalent.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 52% of the total text.

Page 1 of 3

Conversion of Number Representations

There are many situations in which it is necessary to convert a representation of a number having a nonbinary base, where each element (digit if the number has base 10) is binary coded, into a pure binary representation. The most common occurrence is when a decimal number is represented in Binary- Coded Decimal (BCD), where each digit is represented by its binary equivalent.

Consider a five-digit number represented in BCD. The digits of the units, tens, hundreds, thousands and ten-thousands will be called U, D, C, M, N, respectively. Digit U is represented in BCD by four bits U1, U2, U4, U8 with a weight of 1, 2, 4, 8, respectively; digit D is represented by four bits D1, D2, D4, D8 with a weight of 1, 2, 4, 8, respectively, etc.

The value of the number to be converted is equal to: 10 000 N + 1000 M + 100 C + 10 D + U.

Decomposition of the successive powers of the "10" base, gives: 10 = 2(3) + 2(1) 100 = 2(6) + 2(5) + 2(2) 1000 = 2(9) + 2(8) + 2(7) + 2(6) + 2(5) + 2(3) 10 000 = 2(13) + 2(10) + 2(9) + 2(8) + 2(4) Therefore, the value of the number to be converted is equal to: 2(13)N + 2(10)N + 2(9)(N+M) + 2(8)(N+M) + 2(7)M + 2(6)(M+C) + 2(5)(M+C) + 2(4)N + 2(3)(M+D) + 2(2)C + 2(1)D + 2(0)U.

Each of the powers of 2 issued from the decomposition of a power of 10 multiplies a maximum of only two digits of the number to be converted. If each of these figures is replaced by the sum of the bits which represent it, weighted with the appropriate factors, (that is, if N is replaced by 2(3)N8 + 2(2)N4 + 2(1)N2 + 2(0)N1, with a similar decomposition for the other figures) the number of the multiplicating elements of a power of 2 is multiplied by a maximum of four. Therefore, these elements can be distributed within registers in which each position has an equal weight at a power of 2, by using a maximum of eight registers. Thus, it becomes necessary to carry out only seven binary additions to obtain the binary representation of the number.

In fact, seven registers (therefore six additions) are sufficient, since the decomposition never gives more than seven elements with the same binary weight. Fig. 1 shows these registers bearing references R1 to R7, and the way to perform the distribution.

In the example shown, the locations have been chosen by successively considering the powers of 10 in the increasing order, and by first filling the registers with the lowest rank. Thus, first bits N8, N4, N2, N1 are placed into register R1, in the positions of weights 2(16) to 2(13) (that is, in the positions numbered 16, 15, 14 and 13 on the figure), then these same bits into register R2 in the positions of weights 2(13) to 2(10), then these same bits into register R1, in the positions of weights 2(12) to 2(9), then bits M8, M4, M2, M1 into register R3 in the positions of weights 2(12) to 2(9) (these positions being already completely or pa...