banner_BinaryNumSys.gif (11202 bytes)

We should all be familiar with the decimal (or base-ten) number system. Recall that each digit within any given decimal number is associated with a weight. Furthermore, the value of that number is the sum of the digits after each has been multiplied by its weight.

To illustrate let us consider Table 2-1 and assume that the number 654.52, written (654.52)10 to specify base 10, is being represented. Note that the digits range form 0,1,…,9.

 

Hundreds

Tens

Units

One tenth

One hundredth

Weights

102

101

100

10-1

10-2

Digits

6

5

4

5

2

Weighted Value

600

50

4

0.5

0.02

Total 654.52

Table 2-1 Decimal Number System

Just as the decimal system with its ten digits is a base-ten system, the binary number system with its 2 digits, ‘0’ and ‘1’ is a base-two system. Table 2-2 shows the weighting for the binary number system up to 2 decimal places before and 3 places after the binary point (.) note the similarity to the decimal system.

 

Weights

22

21

20

.

2-1

2-2

Table 2-2 Binary Weights

The least significant bit (LSB) is the rightmost binary digit which has the lowest binary weight of a given number.

The most significant bit (MSB) is the leftmost binary digit which has the highest binary weight of a given number.

Counting in binary is similar to the decimal number system. The LSB is begins with zero (0) and is incremented until the maximum digit value is reached. The adjacent bit positions are then filled appropriately as the iterative counting process continues.

 

Conversion from Binary to Decimal

To express the value of a given binary number as its decimal equivalent we just need to sum the digits after each has been multiplied by its associated weight.

Example #1

Convert (110101) 2 to decimal form.

 

Binary Weights

25

24

23

22

21

20

Weight Value

32

16

8

4

2

1

Binary Number

1

1

0

1

0

1

Decimal Value

32

16

0

4

0

1

Total (53)10

 

Example #2

Convert (0.1011) 2 to decimal form.

Binary

Weights

2-1

2-2

2-3

2-4

Weight

Value

0.5

0.25

0.125

0.0625

Binary

Number

1

0

1

1

Decimal

Value

0.5

0

0.125

0.0625

Total

(0.6875)10

 

Conversion from Decimal Whole Numbers to Binary

One way to find the binary number that is equivalent to a given decimal number is to determine the set of binary weights whose sum is equal to the decimal number. For example (24) 10 is equivalent to 24 + 23 i.e. 16 +8, as illustrated below. Thus by placing a one in these weigh positions and zeros elsewhere we realise that (24) 10 = 1*24 + 1*23 + 0*22 + 0*21 + 0*20. Extracting the coefficients of the 2x terms we obtain

(24) 10 = (11000) 2. This is referred to as the sum-of-weights method.

 

Binary Weights

24

23

22

21

20

Weight

Value

16

8

4

2

1

Binary

Number

1

1

0

0

0

 

Alternatively, we may use the more systematic approach called the Repeated-Division-by-2 method shown in the example below.

Converting (18) 10 to binary

  1. Divide the quotient by two and record the remainder.

  2. Repeat step (a) until the quotient is equal to zero (0).

  3. The first remainder produced is the LSB in the binary number and the last remainder (R) the MSB. Accordingly, the binary number is then written (from left to right) with the MSB occurring first

 

 

2

18

2

9

R 0 (LSB)

2

4

R 1

2

2

R 0

2

1

R 0

 

0

R 1 (MSB)

 

Therefore, (18) 10 = (10010) 2

 

Converting Decimal Fractions to Binary

The techniques used to convert decimal fractions to binary are similar to the methods demonstrated previously to convert decimal whole numbers. We may either use the sum-of –weights method or in this case, the repeated multiplication–by-2 method. In the multiplication–by-2 method we repeatedly multiply the fraction by two, and record the carry, until the fraction product is zero. The first carry produced us the MSB, while the last carry is the LSM. Remember that the binary point precedes the MSB. To illustrate lets consider the conversion of (0.3125) 10 to binary.

 

0.3125 * 2

Carry

0.625 * 2

0 (MSB)

0.25 * 2

1

0.50 * 2

0

0.00

1 (LSB)

(0.3125) 10 = (0.0101) 2

 

back2.gif (5659 bytes)next2.gif (4645 bytes)

 


Copyright © Adrian Als , 1999
This page was last modified: Wednesday, April 12, 2000