640 likes | 1.14k Views
Number system. Rashedul Hasan. Commonly used Number System . Decimal Number System. The decimal numeral system has ten as its base. It is the most widely used numeral system, perhaps because humans have ten digits over both hands.
E N D
Number system Rashedul Hasan.
Decimal Number System • The decimal numeral system has ten as its base. • It is the most widely used numeral system, perhaps because humans have ten digits over both hands. • uses various symbols (called digits) for no more than ten distinct values (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9) to represent any numbers,
Decimal Number System • The decimal system is a positional numeral system; it has positions for units, tens, hundreds, etc. • The position of each digit conveys the multiplier (a power of ten) to be used with that digit—each position has a value ten times that of the position to its right.
For example • 848 • 8 Hundreds or 8*100 or 8*102 • 4 tens or 4*10 or 4*101 • 8 units or 8*1 or 8*100
Form the example, • Both the 8 are not equal. • Left most 8 occupies the hundred or 102 position is called MSD that is Most Significant digit. • Right most 8 occupies the units or 100 position is called LSD that is Least Significant digit. • The total value=8*102 + 4*101 +8*100 • = 800+40+8 • 848.
Another example • 1492.76 • 1 thousand or 1*1000 or 1* 103 • 4 Hundreds or 4*100 or 4*102 • 9 tens or 9*10 or 9*101 • 2 units or 2*1 or 2*100 • 7 tenths or 7*0.1 or 7*10-1 • 6 hundredths or 6*0.01 or 6*10-2
Total value = 1* 103 + 4*102 + 9*101 + 2*100 + 7*10-1 + 6*10-2 • = 1000+400+90+2+0.7+0.06 • =1492.76
Binary Number System • The binary numeral system, or base-2 number system, is a numeral system that represents numeric values using two symbols, 0 and 1. • The digits in binary system are called bits. • In binary number system, the value of each digit is based on 2, and powers of 2.
Since binary is a base-2 system, each digit represents an increasing power of 2, with the rightmost digit representing 20, the next representing 21, then 22, and so on. • 25 24 23 22 21 20 • In binary system, if the bit is zero (0), its value is zero.
Bit: O or 1 • Byte: a group of 8 bits is called Byte. • Word: a group of 16 bits is called Word. • Kilobytes KB 210 • Megabyte MB 220 • Gigabyte GB 230 • Terabyte TB 240
Binary to Decimal • If the digit is one (1), its value is determined by its position from the right. For example, the binary number 100101 is converted to decimal form by, • [(1) × 25] + [(0) × 24] + [(0) × 23] + [(1) × 22] + [(0) × 21] + [(1) × 20] = • [1 × 32] + [0 × 16] + [0 × 8] + [1 × 4] + [0 × 2] + [1 × 1] = 37
Decimal to Binary • Divide the number by 2, the remainder is either 0 or 1. • Place the remainder to the right of partial quotient obtained in step 1. • Divide the partial quotient of step 1 by 2, placing the remainder to the right of new partial quotient • Repeat the step 1,2,3 until a quotient of zero is obtained. • The binary number is equal to the remainders arranged so that first remainder is the LSB and the last remainder is MSB of binary number.
Operation Remainder • 118 ÷ 2 = 59 0 • 59 ÷ 2 = 24 1 • 29 ÷ 2 = 14 1 • 14 ÷ 2 = 7 0 • 7 ÷ 2 = 3 1 • 3 ÷ 2 = 1 1 • 1 ÷ 2 = 0 1 • Reading the sequence of remainders from the bottom up gives the binary numeral 11101102
Decimal to Binary • 47 Dividers number remainders 2 47 2 23 1 (LSB) 2 11 1 2 5 1 2 2 1 2 1 0 0 1 (MSB) 4710 = 101111
Decimal to Binary • 76 Dividers number remainders 2 76 2 38 0 (LSD) 2 19 0 2 9 1 2 4 1 2 2 0 2 1 0 0 1(MSD) 7610 = 1001100
Incase of Fraction • 0.625 Multiplier decimal fraction 2 * 0.625 1.25 1 2 * 0.25 .5 0 2 * .5 1.0 1
Incase of Fraction • 0.86 Multiplier decimal fraction 2 * 0.86 1.72 1 2 * 0.72 1.44 1 2 * .44 .88 0 2 * .88 1.76 1
87.125 • 87 [Integral part] Dividers number remainders 2 87 2 43 1 (LSD) 2 21 1 2 10 1 2 5 0 2 2 1 2 1 0 0 1(MSD) 8710 = 1010111
87.125 • .125 [Fraction part] Multiplier decimal fraction 2 * 0.125 .25 0 2 * 0.25 .5 0 2 * .5 1.0 1
Binary to Decimal • 10101 1 0 1 0 1 20*1 = 1 21*0 = 0 22*1 = 4 23*0 = 0 24*1 = 16 21 101012 = 21
In case of fraction • 0.1011 0. 1 0 1 1 2-1*1 = 0.5 2-2*0 = 0 2-3*1 =0.125 2-4*1 = 0.0625 0.6875 0.1011 = 0.6875
Convert binary to Decimal 1101.1101
Octal Number system • The octal number system has a base of eight. And they are, • 0,1,2,3,4,5,6 and 7. • The digit position of an octal number can have only value for 0 to 7. the digit positions in an octal number have weights as follows, • 84 83 82 81 80 8-1 8-2 8-3 8-4
Decimal to Octal conversion • Divide the Decimal number by 8 • Place reminder to the right of partial quotient obtained in step 1. • Divide the partial quotient of step 1 by 8, placing the remainder to the right of new partial quotient • Repeat the step 1,2,3 until a quotient of zero is obtained. • The binary number is equal to the remainders arranged so that first remainder is the LSD and the last remainder is MSD of octal number.
Decimal to Octal conversion • 573 Dividers number remainders 8 573 8 71 5 (LSD) 8 8 7 8 1 0 0 1 (MSD) 57310 = 1075
Decimal to Octal conversion • 2536 Dividers number remainders 8 2536 8 317 0 (LSD) 8 39 5 8 4 7 0 4 (MSD) 253610 = 4750
Octal to Decimal • The extreme right hand digit is multiplied by 80 the second from the right by 81 and So on. • Then add all this products to get decimal equivalent of the octal number. • In case of octal fraction, multiply the first digit after octal point by 8-1, second digit from octal point by 8-2 • Then add all this products to get decimal equivalent of the octal number.
Octal to Decimal • 1075 1 0 7 5 80 * 5 = 5 81 * 7 = 56 82 * 0 = 0 83* 1 = 512 573
Octal to Decimal • 0.44 0. 4 4 8-1 * 4 = 0.5 8-2 * 4 = 0.0625 0.5625
Octal to DecimalAssignment • 4750 • 0.6256
Octal to Binary • 576 5 7 6 111 101 110 576 = 101111110
Octal to Binary In case of Fraction 0.216 0. 2 1 6 010 001 110 0.216 = 0.010001110
Octal to Binary • 27.12
Binary to Octal • Group the binary bits in three. • For grouping the bits in three, move towards left from binary point. • In case of even number, add zero or zeros at appropriate place. • Replace each group of threes bits by equivalent octal numbers.
110111101 110 111 101 6 5 7
11000110 011 000 110 3 6 0
Assignment • 1111000 • Ans. 170
Hexadecimal • The base is 16, it has 16 possible digit symbol. • 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E and F • The digit positions in an octal numbers have weights as follows, • 164 163 162 161 160 16-1 16-2 16-3 16-4 • Each hexadecimal digit represent group of four (4) binary digits. • hexadecimal digit A-F are equivalent to decimal values 10 – 15.
Relationship between Hexadecimal, Decimal and Binary digits.
Decimal to Hexadecimal • Divide the number by 16 • Place reminder to the right of partial quotient obtained in step 1. • Divide the partial quotient of step 1 by 16, placing the remainder to the right of new partial quotient • Repeat the step 1,2,3 until a quotient of zero is obtained. • The binary number is equal to the remainders arranged so that first remainder is the LSD and the last remainder is MSD of octal number.
Decimal to Hexadecimal • 741 Dividers number remainders 16 741 16 46 5 (LSD) 16 2 14 i.e E 0 2(MSD) 74110 = 2E5
Decimal to Hexadecimal • 2536
Decimal to Hexadecimal • In case of Fraction • 0.256 16 * 0.256 4.096 4 16 * 0.096 1.536 1 16 * 0.536 8.576 8 16 * 0.576 9.216 9
Decimal to Hexadecimal • 0.3942
Decimal to Hexadecimal • 97.236 Integral Part Dividers number remainders 16 97 16 6 1 (LSD) 16 0 6 (MSD)
Decimal to Hexadecimal • Fraction Part Multiplier fraction & Partial product 16 * 0.236 3.776 3 16 * 0.776 12.416 12/C 16 * 0.416 6.656 6 16 * 0.656 10.496 10/A
Hexadecimal to Decimal • 1F95 1 F 9 5 160 * 5 = 5 161 * 9 = 144 162 * F = 3840 163* 1 = 4096 8085
Hexadecimal to Decimal • 475C
Hexadecimal to Decimal • 0.48 0. 4 8 16-1 * 4 = 0.25 16-2 * 8 = 0.03125 0.28125