Anda di halaman 1dari 4

BASE CONVERSION OPERATIONS

Basics
The number system that we work in is called the Decimal System. This is because there are 10 digits in the system namely 0 to 9. There can be alternative systems that can be used for arithmetic operations. For example, in the binary system, the digits allowed to be used are: 0 and 1; in the octal system, the digits allowed to be used are: 0, 1, 2, 3, 4, 5, 6 and 7; in the hexadecimal system, the digits allowed to be used are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Note that A means 10, B means 11 and so on and hence F means 15. In general, in the base system n, the digits allowed to be used are: 0, 1, 2, 3, , (n 1). To denote a number in any base system, we use subscripts. E.g., if we have a number 23157 and which is in octal system, then we write this number as (23157)8. Similarly, (4BE5)16 is a number in hexadecimal system.

Conversions from Base 10 to x and x to 10


Conversion from base 10 to base x To convert a number from base 10 to base x, we divide the number successively by x and obtain remainder is each case. For example, Convert (352)10 to base 7. Divide 352 successively by 7 as shown below

7 352 7 50 7 7 7 1 0

2 1 0 1

When 352 is divided by 7, we are left with quotient 50 and remainder 2. When quotient 50 is further divided by 7, we are left with quotient 7 and remainder 1. When quotient 7 is further divided by 7, we are left with quotient 1 and remainder 0. Finally, when the quotient 1 is divided by 7, we are left with quotient 0 and remainder 1. The remainders are now collected in the reverse order, i.e. the last remainder is the leftmost digit when we write the number in base 7. So, (352)10 = (1012)7. Convert 122 from decimal system to the octal system. Divide the number in the decimal system by the new base (8 in this case) till the quotient becomes 0 and note down the remainders. Writing down the successive remainders in the reverse order will yield the number in octal system. 122 = 15 R2 (15 R2 means a quotient of 15 and a remainder of 2) 8

15 = 1 R7 8 1 = 0 R1 8

(Quotient 1 and remainder 7) (Quotient 0 and remainder 1)

(122)10 = (172)8.
Conversion from base x to base 10 To convert from base x to base 10, we multiply rightmost digit with x0, the next digit with x1, the next digit with x2, and so on and add all these terms. For example,

Convert (3216)8 to base 10. Multiply 6 with 80, multiply 1 with 81, multiply 2 with 82, and multiply 3 with 83, and finally add all these terms. So, we get 6 80 + 1 81 + 2 82 + 3 83 = 6 + 8 + 128 + 1536 = (1678)10.

Direct Conversions
Direct conversion from base x to base y is possible only in those cases where one of the bases is an integral power of the other base. So, conversion from base 2 to base 4 (i.e. 22), or base 8 (i.e. 23), base 16 (i.e. 24) is possible and vice versa. Similarly, we can convert directly from base 3 to 9 and vice versa, and so on. In general, we can convert directly from base x to base xn and xn to x. Direct Conversion from base x to base xn To convert directly from base x to base xn, form groups of n digits from right side of the given number. Convert each group into base 10. Write the obtained digits in the same order, i.e. if rightmost group of n digits gives the result p, then p is the rightmost digit in the base xn. For example,

Convert (110101111001011)2 to octal system. Since octal system means base 8, where 8 = 23, form groups of 3 digits from the rightmost side. We get
110 101 111 001 011

Convert each digit group to base 10. So, (110)2 = (6)10; (101)2 = (5)10; (111)2 = (7)10; (001)2 = (1)10; (011)2 = (3)10. So, (110101111001011)2 = (65713)8.

Convert (110101111001011)2 to hexadecimal system. Since hexadecimal octal system means base 16, where 16 = 24, form groups of 4 digits from the rightmost side. We get
0110 1011 1100 1011

Convert each digit group to base 10. So, (0110)2 = (6)10; (1011)2 = (11)10 = (B)16 (in case we get two digit answers, then we convert that two digit number into the required base); (1100)2 = (12)10 = (C)16; (1011)2 = (11)10 = (B)16. So, (110101111001011)2 = (6BCB)16. Direct Conversion from base xn to base x

To convert directly from base xn to base x, convert each digit to base x, keeping in mind that the number of digits in the converted form should have exactly n digits. The order of writing the digits will be same as in the given number. For example,

Convert (325417)8 to binary system. Convert 3 to base 2. We get (11)2, but to ensure that it has exactly 3 digits (as we are converting from base 23 to base 2), we write it as (011)2. Similarly, 2 = (10)2 = (010)2; 5 = (101)2; 4 = (100)2; 1 = (001)2; 7 = (111)2. So, (325417)8 = (011010101100001111)2. Convert (54732)8 to hexadecimal system. In such questions, we should convert from base 8 to base 2 and then from base 2 to base 16. 5 = (101)2; 4 = (100)2; 7 = (111)2; 3 = (011)2; 2 = (010)2. So, (54732)8 = (101100111011010)2. Now, convert from binary to hexadecimal, by forming groups of 4 digits from right side. Therefore, (101100111011010)2 = 0101 1001 1101 1010 = (59DA)16.

Arithmetic Operations on Base System


Now, we will learn how to perform additions, subtraction and multiplication on numbers which are in the base other than decimal system. ADDITION:

Add (3257)8 to (2654)8 To add, we start from the rightmost digits of both the numbers and add then as we normally add. So, 7 + 4 = 11. Now, 11 is divided by the base 8 and we obtain quotient 1 and remainder 3. The remainder is the rightmost digit of the answer and the quotient 1 becomes the carry-over. This process is continued and we finally obtain the answer as presented below:

1 1 1 (3 2 5 7)8 + (2 6 5 4)8 (6 1 3 3)8


SUBTRACTION:

Subtract (4357)8 from (6125)8 If the digit which is subtracted is less than or equal to the one from which subtraction takes place, then we just subtract as usual. If the digit which is subtracted is more, then we borrow a one from the previous digit (from which subtraction takes place) and the borrowing amount is same as the base system. In the current example, 5 is less than 7 and so we borrow a one from the previous digit 2. The borrowing amount is 8 (which is the base system). So, we get 5 + 8 = 13 and 13 7 = 6, which is part of the answer. This process is continued and we finally obtain the answer as presented below:

(6 1 2 5)8

(4 3 5 7)8
(1 5 4 6)8
MULTIPLICATION: Multiplication process essentially is same as addition process. For example, 7 4 means 7 added 4 times. So, the basic principles of multiplication are exactly same as for addition. Below is presented a sample example.

(2 5)8 (4 7)8 (2 (1 (1
12 22 24)8 43)8

3)8

So, 5 7 = 35, which when divided by divided by 8 leaves 4 as quotient and 3 as remainder. Note that the quotient 4, which acts as carry-over, is written as subscript just before 3. So, (25)8 (7)8 = (223)8 and (25)8 (4)8 = (124)8, which is treated as (1240)8, as is usually done in the ordinary process of multiplication. Finally we add 223 and 1240 in base 8, as we have learnt earlier.

Perform the following calculations: (i) (4235)7 + (2354)7 = (..............)7 (iii) (2342)6 (1345)6 = (..............)6 Answers (i) (6622)7 (ii) (1143B)16 (iii) (553)6 (iv) (1047)8

(ii) (AB5F)16 + (68DC)16 = (.....................)16 (iv) (23)8 (35)8 = (........)8

Anda mungkin juga menyukai