410 likes | 710 Views
Converting a binary number into decimal of both integral and fractional part, converting a decimal number into binary of both integral and fractional part
E N D
Number System Conversion Mrs. M. Virgin Arockia Mary Asst. Professor Department of Commerce with Computer Applications Arul Anandar College Karumathur Madurai
Number System Conversion As you know decimal, binary, octal and hexadecimal number systems are positional value number systems. To convert binary, octal and hexadecimal to decimal number, we just need to add the product of each digit with its positional value. Here we are going to learn conversion among decimal and Binary number systems.
Decimal to Binary ConversionBinary to Decimal Conversion Convert a binary number into decimal number Decimal number into Binary
Decimal to Binary Conversion • Decimal Numbers are converted into binary by a method called Double Dabble Method. • In this method the mantissa part of the number is repeatedly divided by two and noting the remainders, which will be either 0 or 1. This division is continued till the mantissa becomes zero. • The remainders, which are noted down during the division is read in the reverse order to get the binary equivalent.
Decimal to Binary ConversionExample 1 The remainders are to be read from bottom to top to obtain the binary equivalent. (43)10 = (101011)2
Example 2 Result is from Bottom to Up
Decimal fraction into Binary • The fractional part of the number is found by successively multiplying (known as successive multiplication) the given fractional part of the decimal number repeatedly by 2 (×2), noting the carries in forward order, until the value becomes “0” producing the binary equivalent. • So if the multiplication process produces a product greater than 1, the carry is a “1” and if the multiplication process produces a product less than “1”, the carry is a “0”.
Example 1 • Convert Decimal to Binary – 0.8125 So to find the binary fraction equivalent of the decimal fraction: 0.812510 0.8125 (multiply by 2) = 1.625 = 0.625 carry 1 (MSB) 0.625 (multiply by 2) = 1.25 = 0.25 carry 1 (↓) 0.25 (multiply by 2) = 0.50 = 0.5 carry 0 (↓) 0.5 (multiply by 2) = 1.00 = 0.0 carry 1 (LSB) Thus the binary equivalent of 0.812510 is therefore: 0.11012 ← (LSB)
Example 2 Find the binary equivalent of the following decimal number: 54.6875 First we convert the integer 54 to a binary number in the normal way using successive division from above. • 54 (divide by 2) = 27 remainder 0 (LSB) • 27 (divide by 2) = 13 remainder 1 (↑) • 13 (divide by 2) = 6 remainder 1 (↑) • 6 (divide by 2) = 3 remainder 0 (↑) • 3 (divide by 2) = 1 remainder 1 (↑) • 1 (divide by 2) = 0 remainder 1 (MSB) Thus the binary equivalent of 5410 is therefore: 1101102
Next we convert the decimal fraction 0.6875 to a binary fraction using successive multiplication. • 0.6875 (multiply by 2) = 1.375 = 0.375 carry 1 (MSB) • 0.375 (multiply by 2) = 0.75 = 0.75 carry 0 (↓) • 0.75 (multiply by 2) = 1.50 = 0.5 carry 1 (↓) • 0.5 (multiply by 2) = 1.00 = 0.0 carry 1 (LSB) • Thus the binary equivalent of 0.687510 is therefore: 0.10112 ← (LSB) • Hence the binary equivalent of the decimal number: • 54.687510 = 110110.10112
Example: 3 Convert the decimal Number into Binary 2.47 2.47 First convert 2 into Binary 2 divided by 2 = 1 and reminder 0 So (2)10= (10)2 Next do the fractional part
0.47 • 0.47 X 2 = 0.94 0 • 0.94 X 2 = 1.88 1 • 0.88 X 2 = 1.76 1 • 0.76 X 2 = 1.52 1 • 0.52 X 2 = 1.04 1 • 0.04 X 2 = 0.08 0 • Ans : (2.47)10 = ( 10. 011110)2
Binary • Binary is the simplest kind of number system that uses only two digits of 0 and 1 (i.e. value of base 2). Since digital electronics have only these two states (either 0 or 1), so binary number is most preferred in modern computer engineer, networking and communication specialists, and other professionals. • Whereas Decimal number is most familiar number system to the general public. It is base 10 which has only 10 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
Representation of a Binary Number Integral Part of the decimal number value is increased from right to left.
Representation of Binary Number • Fractional Part of the decimal number value is decreased from left to right.
Example-1 − Convert binary number 11001010 into decimal number. Since there is no binary point here and no fractional part. So, =1 X 27 + 1 X 2 6 + 0 X 25 + 0 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 0 X 20 = 1 X 128 +1 X 64 + 0 X 32 + 0X 16 + 1 X 8 + 0 X 4+ 1 X 2 +0 X 1 = 128 + 64 + 0 + 0 + 8 + 0 + 2 + 0 = 202
Example 2 Convert Binary to Decimal (101101)2 in decimal is = 1 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20 = 1 x 32 + 0 x 16 + 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1 = 32 + 8 + 4 + 1 = (45)10
Converting Fractional Binary to Decimal • Divide each digit from right side of radix point till the end by 21, 22, 23, … respectively. • Add all the result coming from step 1. • Equivalent fractional decimal number would be the result obtained in step 2.
Example 1 • .110 • = = = 1× 0.5 + 1× 0.250 + 0 × 0.125 = 0.5 + 0.250 = 0.75
Binary number with integral and fractional part • If a binary number with integral part and fractional part, the integral part and fractional part are calculated separately. • First find out the integral part equivalent of decimal number then calculate the fractional part of the binary.
Example 1 • 111 . 111 • First Do the Integral Part 111 • = 1 X 22 + 1 X 21 + 1 X 20 • = 1 X 4 + 1 X 2 + 1 X 1 • = 4 + 2 +1 • = 7 Fractional Part Integral Part
Second do the Fractional part = = = 1 X 0.5 + 1 X 0.25 + 1 X 0.125 = 0.875 Now combine both Integral and Fractional Part value (111.111)2 = ( 7. 875)10
Example 2 11.01011 11 = 1 X 21 + 1 X 20 3 .01011 = = = 0 + 0.25 + 0 + 0.0625 + 0.03125 0.3475 (11.01011)2 = ( 3. 3475)10