You are on page 1of 11

UNIVERSITI KUALA LUMPUR

MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY

CHAPTER 6 : BASE NUMBERS


6.1 NUMBER CONVERSION

There is much other numbering system - mostly associated with computers. These include:
1. Binary Octal
2. Hexadecimal
3. Binary Coded Decimal (BCD)

6.1.1 The Decimal System

This is the system in everyday use; there are 10 digits (0 to 9 inclusive) so it has a 'base' of 10.

Example:
1. Taking the number 7213, it can be written as:

(7 x 1000) + (2 x 100) + (1 x 10) + (3 x 1)


= (7 x 103 ) + (2 x 102 ) + (1 x 101) + (3 x 100)
= 7213
Each digit is effectively multiplied by a power of 10

2. Note that to write 12.37 in power of 10


(1 x 10') + (2 x 100) + (3 x 10-1) + (7 x 10-2)
= (10) + (2) + (0.3) + (0.07)
= 12.37
Note that 10 0 = 1. ln fact any number to the power of zero = 1

6.1.2 Binary System

Let's look at base-two, or binary, numbers. How would you write, for instance, 1210 as a binary
number? You would have to convert to base-two columns, the analogue of base-ten columns. In
base two, you have 20 = 1, 21 = 2, 22 = 4, 23 = 8, 24 = 16, and so forth. The first column in base-two
math is the units column. But only "0" or "1" can go in the units column. When you get to "two",
you find that there is no single solitary digit that stands for "two" in base-two math. Instead, you put
a "1" in the twos column and a "0" in the units column, indicating "1 two and 0 ones". The base-ten
"two" (210) is written in binary as 102.

1
UNIVERSITI KUALA LUMPUR
MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY
Here is a listing of the first few numbers:

Decimal Binary
(base 10) (base 2)
0 0 0 ones
1 1 1 one
2 10 1 two and zero ones
3 11 1 two and 1 one
4 100 1 four, 0 twos, and 0 ones
5 101 1 four, 0 twos, and 1 one
6 110 1 four, 1 two, and 0 ones
7 111 1 four, 1 two, and 1 one
8 1000 1 eight, 0 fours, 0 twos, and 0 ones
9 1001 1 eight, 0 fours, 0 twos, and 1 one
10 1010 1 eight, 0 fours, 1 two, and 0 ones
11 1011 1 eight, 0 fours, 1 two, and 1 one
12 1100 1 eight, 1 four, 0 twos, and 0 ones
13 1101 1 eight, 1 four, 0 twos, and 1 one
14 1110 1 eight, 1 four, 1 two, and 0 ones
15 1111 1 eight, 1 four, 1 two, and I one
16 10000 1 sixteen, 0 eights, 0 fours, 0 twos, and 0 ones

Converting between binary and decimal numbers is fairly simple, as long as you remember that each
digit in the binary number represents a power of two.

Example

1. Convert 1011001012 to the corresponding base-ten number

List the digits in order, and count them off from the RIGHT, starting with zero:

Digits : 101100101
Numbering : 876543210

Use this listing to convert each digit to the power of two that it represents:

(1 x 28 )+( 0 x 27 )+ (1 x 26 )+ (1 x 25 )+ (0 x 24)+(0 x 23 )+ (1 x 22)+ (0 x 21)+ (1 x 20)


= (1 x 256) + (0 x 128) + (1 x 64) + (1 x 32) + (0 x 16) + ( 0 x 8) + (1 x 4) + (0 x 2) + (1 x 1)
= 256 + 64 + 32 + 4 + 1
= 357

Answer : Then 1011001012 convert to 35710

Converting decimal numbers to binaries is nearly as simple: just divide by 2.

2
UNIVERSITI KUALA LUMPUR
MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY
2. Convert 35710 to the corresponding binary number. To do this conversion, you need to
divide repeatedly by 2, keeping track of the remainders as you go. Watch below:

As you can see, after dividing repeatedly by 2, I ended up with these remainders

2 357
2 178 R1
2 89 R0
2 44 R1
2 22 R0
2 11 R0
2 5 R1
2 2 R1
2 1 R0
2 0 R1

These remainders tell us what the binary number is. Read the numbers from around the
outside of the division, starting on bottom and wrapping your way around the right-hand
side.

Answer: 35710 converts to 101 1001012

6.1.3 Octal System

An older computer base system is "octal" or base-B number system. The digits in octal are
0,1,2,3,4,5,6 and 7. The value "eight" is written as 1 eight and 0 ones or 108

DECIMAL TO OCTAL CONVERSION

Method used division by 8:-


Divide the quotient by eight and record the remainder.
Repeat step until the quotient is equal to zero (0)
The remainder is read from bottom to top

Example:

Convert 35910 to Octal:

8 359
8 44 R7
8 5 R4
8 0 R5

Read from bottom to top


Therefore, 35910 = 5478

3
UNIVERSITI KUALA LUMPUR
MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY
OCTAL TO DECIMAL CONVERSION

Method used: sum the digits after each has been multiplied by its associated weight

Example:

Convert 2378 to Decimal

Base 8 82 81 80
Decimal 2 3 7

Solution = (2 x 82) + (3 x 81) + (7 x 80)


= (2 x 64) + (3 x 8) + (7 x 1)
= 128 + 24 + 7
=15910

BINARY TO OCTAL CONVERSION

Method used: replace each octal digit with the appropriate three-bit binary number

Octal Digit Binary Digit


0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

Example: Convert 138 to binary

Solution = 001 0112

OCTAL TO BINARY CONVERSION

Method use: Break the binary digits into groups of three from right/decimal point and convert each
group into its appropriate octal digit.

Example: Converting (010111)2 to Octal

Solution: 111 = 7 (LSB)


010 = 2 (MSB)

thus, (010111)2=(27)8

4
UNIVERSITI KUALA LUMPUR
MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY
6.1.4 Hexadecimal System

Hexadecimal describes a base-16 number system. The hexadecimal numbers are 0-9 and then use
the letters A-F. We show the equivalence of binary, decimal, and hexadecimal numbers in the table
below.

Binary Decimal Hexadecimal


0 0 0
1 1 1
10 2 2
11 3 3
100 4 4
101 5 5
110 6 6
111 7 7
1000 8 8
1001 9 9
1010 10 A
1011 11 B
1100 12 C
1101 13 D
1110 14 E
1111 15 F

DECIMAL TO HEXADECIMAL CONVERSION

Method used: division by 16:


Divide the quotient by sixteen and record the remainder
Repeat step until the quotient is equal to zero (0).
The remainder is read from bottom to top

Example : 123410 to Hexadecimal

Solution :
16 1234
16 77 R2
16 4 R13 = D
16 0 R4

Read from bottom to top

Therefore, 1234 10 = 4D2H, or 4D216

5
UNIVERSITI KUALA LUMPUR
MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY
HEXADECIMAL TO DECIMAL CONVERSION

Method use: sum the digits after each has been multiplied by its associated weight

Example : Convert 4D216 to Decimal

Solution :
162 161 160
4 D 2

Thus, = (4 x 162) + (D x 161) + (2 x 160)


= (4 x 162) + (13 x 161) + (2 x 160) *D is equivalent to 13
= (4 x 256) + (13 x 16) + (2 x 1)
= 1024 + 208 + 2
=123410

HEXADECIMAL TO BINARY CONVERSION AND VISE VERSA

Method use: The easiest way is to use the table below

Hexadecimal Binary Digit


0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111

Example:

1. Convert F816 to Binary

Solution: F = 1111
8 = 1000

Thus, F816 = 1111 10002

6
UNIVERSITI KUALA LUMPUR
MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY
2. Convert 111010110102 to Hexadecimal

Solution: Break the binary digits into groups of four from right/decimal point and
convert each group into its appropriate hex digit

0111 0101 1010

7 5 A

Thus, 111010110102 = 75A16

6.2 BINARY ARITHMETIC

Arithmetic in binary is much like arithmetic in other numeral systems. Addition, subtraction,
multiplication, and division can be performed on binary numerals.

6.2.1 Addition

The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is
relatively simple:
0+0  0
0+1  1
1+0  1
1+1  0, carry 1 (since 1 + 1= 0 + 1 x 10 in binary)

Adding two "1" digits produces a digit "0", while 1 will have to be added to the next column. This is
similar to what happens in decimal when certain single-digit numbers are added together; if the
result equals or exceeds the value of the radix (10), the digit to the left is incremented

5+5  0, carry 1 (since 5 + 5 = 0 + 1 x 10)


7+9  6, carry 1 (since 7 + 9 = 6 + 1 x 10)

This is known as carrying. When the result of an addition exceeds the value of a digit, the procedure
is to "carry" the excess amount divided by the radix (that is, 10/10) to the left, adding it to the next
positional value. This is correct since the next position has a weight that is higher by a factor equal to
the radix. Carrying works the same way in binary.

7
UNIVERSITI KUALA LUMPUR
MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY
Example

1 1 1 1 1 (carried digits)
0 1 1 0 1
+ 1 0 1 1 1
= 1 0 0 1 0 0

In this example, two numerals are being added together: 011012 (13-decimal) and 101112 (23
decimal). The top row shows the carry bits used. Starting in the rightmost column, 1 + 1= 102. The 1
is carried to the left, and the 0 is written at the bottom of the rightmost column. The second column
from the right is added: 1 + 0 + 1 = 102 again; the list carried and is written at the bottom. The third
column: 1 + 1 + 1 =112. This time ,a 1 is carried, and a 1 is written in the bottom row. Proceeding like
this gives the final answer 1001002 (36 decimal)

6.2.2 Subtraction

Subtraction works in much the same way:


00  0
01  1, borrow 1
10  1
11  0

Subtracting a "1" digit from a "0" digit produces the digit 1, while 1 will have to be subtracted from
the next column. This is known as borrowing. The principle is the same as for carrying. When the
result of a subtraction is less than 0, the least possible value of a digit, the procedure is to "borrow"
the deficit divided by the radix (that is, 10/10) from the left, subtracting it from the next positional
value.

Example

* * * * (carried digits)
1 1 0 1 1 1 0
- 1 0 1 1 1
= 1 0 1 0 1 1 1

Subtracting a positive number is equivalent to adding a negative number of equal absolute value;
computers typically use two's compliment notation to represent negative values' This notation
eliminates the need for a separate "subtract" operation. A - B = A + not B +1

6.2.3 Multiplication

Multiplication in binary is similar to its decimal counterpart. Two numbers A and B can be multiplied
by partial products: for each digit in B, the product of that digit-in A is calculated and written on a
new line, shifted leftward so that its rightmost digit lines up with the digit in B that was used. The
sum of all these partial products give the final result.

8
UNIVERSITI KUALA LUMPUR
MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY
Since there are only two digits in binary, there are only two possible outcomes of each partial
multiplication:

lf the digit in B is 0, the partial product is also 0.


lf the digit in B is 1, the partial product is equal to A

Example

1. For example, the binary numbers 1011 and 1010 are multiplied as follow:

1 0 1 1 (A)
x
1 0 1 0 (B)
0 0 0 0
+ 1 0 1 1 Corresponds to a zero in B
+ 0 0 0 0 Corresponds to a one in B
+ 1 0 1 1
= 1 1 0 1 1 1 0
2. Binary numbers can also be multiplied with bits after a binary point:

1 0 1 .1 0 1 (A) (5.625 in decimal)


x 1 1 0 .0 1 (B) (6.25 in decimal)
1 0 1 1 0 1 Corresponds to one in B
+ 0 0 0 0 0 0 Corresponds to a zero in B
+ 0 0 0 0 0 0
+ 1 0 1 1 0 1
+ 1 0 1 1 0 1
= 1 0 0 0 1 1 .0 0 1 0 1 (35.15625 in decimal)

6.2.4 Division

Binary division is again similar to its decimal counterpart:

1 0 1 1 1 0 1 1

Here, the divisor is 1012, or 5 decimal, while the dividend is 110112, or 27 decimal. The procedure is
the same is that of decimal long division; here, the divisor 1012 goes into the first three digits 1102 of
the dividend one time, so a "1" is written on the top line. This result is multiplied by the divisor, and
subtracted from the first three digits of the dividend; the next digit (a "1") is included to obtain a
new three-digit sequence:

9
UNIVERSITI KUALA LUMPUR
MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY
Example

1
1 0 1 1 1 0 1 1
- 1 0 1
0 1 1

The procedure is then repeated with the new sequence, continuing until the digits in the dividend
have been exhausted.

1
1 0 1 1 1 0 1 1
- 1 0 1
0 1 1
- 0 0 0
1 1 1
- 1 0 1
1 0

Thus, the quotient of 110112 divided by 1012 is 1012, as shown on the top line, while the remainder,
shown on the bottom line, is 102. ln decimal, 27 divided by is 5, with a remainder of 2.

10
UNIVERSITI KUALA LUMPUR
MALAYSIAN INSTITUTE OF AVIATION TECHNOLOGY
EXERCISE/ASSIGNMENT:

1. Convert the following decimal numbers to binary number


a. 8410
b. 12410
c. 410

2. Convert the following decimal numbers to octal numbers:


a. 32410
b. 7710
c. 8510

3. Express the following decimal numbers to hexadecimal numbers


a. 17810
b. 5510
c. 20710

4. Convert the binary numbers to decimal numbers


a. 101112
b. 1112
c. 111012

5. What would the following octal numbers be in decimal numbers?


a. 14408
b. 3728
c. 748

6. Convert the hexadecimal numbers to decimal numbers


a. 3CE16
b. A0316
c. 5616

7. Calculate the octal numbers equivalent of the following binary numbers


a. 1011112
b. 1010102
c. 110112

8. Convert the following octal numbers to binary numbers:


a. 13168
b. 26548
c. 5278

9. Calculate the octal numbers equivalent of the following binary numbers


a. 1011112
b. 1010102
c. 110112

10. Convert the following octal numbers to binary numbers:


a. 13168
b. 26548
c. 5278

11

You might also like