Friday, 11 December 2020

Computer Number System Conversions with Examples

 

Converting From One Number System to Another

 

Converting From Another Base to Decimal:

 

The following steps are used to convert a number in any other base to a base 10(decimal) number:

 

Step 1: Determine the column (positional) value of each digit (this depends on the position of the digit and the base of the number system).

 

Step 2: Multiply the obtained column values (in step 1) by the digits in the corresponding columns.

 

Step 3: Sum up the products calculated in step 2. The total is the equivalent value in decimal.

 

Ex 1:

 

47068=? 10

 

Step 1: Determine the column values.

 

 Column number

(from right)

Column

 value

1

80 = 1

2

81 = 8

3

82 = 64

4

83 = 512

 

 

Step 2: Multiply column values by the corresponding column digits.

 

512

64

8

1

x 4

x 7

x 0

x 6

2048

448

0

6

 

 

Step 3: Sum up the products

 

2048 + 448 + 0 + 6 = 2502

 

Hence, 47068= 250210

 

 

 

 

 

Ex 2:

 

1AC16=? 10

 

1AC16 =1x162 + Ax161 + Cx160

            =1x256 + 10x16 + 12x1

            = 256 + 160 +12

            = 42810

 

Ex 3:

 

4052 7=? 10

 

4052 7  = 4x73 + 0x72 + 5x71 + 2x70

            = 4x 343 + 0 x 49 + 5x7+ 2x1

            = 1372 + 0 + 35 + 2

            = 140910

 

Ex 4:

 

4052 6=? 10

 

4052 6  = 4x63 + 0x62 + 5x61 + 2x60

            = 4x216 + 0x36 + 5x6 + 2x1

            = 864 + 0 + 30 + 2

            = 89610

 

 

110014=? 10   (Ans: 32110)

 

1AC13=? 10     (Ans: 31110)

 

 

Converting From Decimal to Another Base (Division Remainder Technique):

 

The following steps are used to convert a base 10(decimal) number to a number in another base:

 

Step 1: Divide the decimal number to be converted by the value of the new base.

Step 2: Record the remainder from Step 1 as the rightmost digit (least significant digit) of the new base number.

Step 3: Divide the quotient of the previous division by the new base.

Step 4: Record the remainder from Step 3 as the next digit (to the left) of the new base number.

 

Repeat Steps 3 and 4, recording remainders from right to left, until the quotient becomes zero in Step 3. Note that the last remainder thus obtained will be the most

significant digit (MSD) of the new base number.


Div-Rem Ex1


Div-Rem Examples


Converting from a Base Other Than 10 to Another Base Other Than 10:

 

The following steps are used to convert a number in a base other than 10, to a number in another base other than 10:

 

Step 1: Convert the original number to a decimal number (base 10).

Step 2: Convert the decimal number so obtained to the new base number.

 

Examples:

Ex 3.15


Ex 3.17



Shortcut Method for Binary to Octal Conversion:

 

The following steps are used in this method:

 

Step 1: Divide the digits into groups of three starting from the right.

Step 2: Convert each group of three binary digits to one octal digit using the method of binary to decimal conversion.

 

Examples:

Ex 3.18



Shortcut Method for Octal to Binary Conversion:

 

Step 1: Convert each octal digit to a 3 digit binary number (the octal digits may be treated as decimal for this conversion).

Step 2: Combine all the resulting binary groups (of 3 digits each) into a single binary number.

 

Examples:

Ex 3.20



Shortcut Method for Binary to Hexadecimal Conversion:

 

Step 1: Divide the binary digits into groups of four starting from the right.

Step 2: Combine each group of four binary digits to one hexadecimal digit.

 

Examples:

Ex 3.22


Shortcut Method for Hexadecimal to Binary Conversion:

 

Step 1: Convert the decimal equivalent of each hexadecimal digit to a 4 digit binary number.

Step 2: Combine all the resulting binary groups (of 4 digits each) in a single binary number.

 

Examples:

Ex 3.24


Fractional Numbers:

 

In binary number system, fractional numbers are formed in the same way as in a decimal number system. For example, in decimal number system,

 

0.235 = (2x10-1) + (3x10-2) + (5x10-3) and

 

68.53 = (6x101) + (8x100) + (5x10-1) + (3x10-2)

 

Similarly, in binary number system,

 

0.101 = (1x2-1) + (0x2-2) + (1x2-3) and

 

10.01 = (1x21) + (0x20) + (0x2-1) + (1x2-2)

 

Hence, binary point serves the same purpose as decimal point. Some positional values in binary number system are given below.

Fractional number representation


In general, a number in a number system with base ‘b’ would be written as:

 

an an-1… a0 . a-1 a-2 … a-m

 

and would be interpreted to mean:

 

an x bn + an-1 x bn-1 + … + a0 x b0 + a-1 x b-1 + a-2 x b-2 + … + a-m x b-m

 

The symbols an, an-1, …, a-m in above representation should be one of the ‘b’ symbols allowed in the number system.

 

 

Examples:


Ex 3.26

Ex 3.28


No comments:

Post a Comment