Number system Writer Rashedul Hasan Editor Jasim Uddin
Number system Writer: -Rashedul Hasan. Editor: - Jasim Uddin
Commonly used Number System Base Number system 2 Binary Digits/symbol used 0, 1 8 Octal 0, 1, 2, 3, 4, 5, 6, 7 10 Decimal 16 Hexadecimal 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
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*101 ► 8 units 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 ► 4 Hundreds ► 9 tens ► 2 units ► 7 tenths 1 ► 6 -2 or or or 1*1000 4*100 9*10 2*1 7*0. 1 or or or 1* 103 4*102 9*101 2*100 7*10 - hundredths or 6*0. 01 or 6*10
► 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 2 2 2 ► 4710 = 101111 number 47 23 11 5 2 1 0 remainders 1 (LSB) 1 1 1 0 1 (MSB)
Decimal to Binary 76 Dividers 2 2 2 2 ► 7610 = 1001100 number 76 38 19 9 4 2 1 0 remainders 0 (LSD) 0 1 1 0 0 1(MSD)
Incase of Fraction ► 0. 625 Multiplier 2 2 2 * * * decimal fraction 0. 625 1. 25 0. 25. 5. 5 1. 0 1
Incase of Fraction ► 0. 86 Multiplier 2 2 * * decimal fraction 0. 86 1. 72 0. 72 1. 44. 88 1. 76 1 1 0 1
87. 125 ► 87 [Integral part] Dividers 2 2 2 2 8710 = 1010111 number 87 43 21 10 5 2 1 0 remainders 1 (LSD) 1 1 0 1(MSD)
87. 125 ►. 125 [Fraction part] Multiplier 2 2 2 * * * decimal fraction 0. 125. 25 0. 25. 5. 5 1. 0 0 0 1
Binary to Decimal ► 10101 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
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, ► 8 4 83 8 2 8 1 8 0 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. 1. 2.
Decimal to Octal conversion ► 573 Dividers 8 8 57310 = 1075 number 573 71 8 1 0 remainders 5 (LSD) 7 0 1 (MSD)
Decimal to Octal conversion ► 2536 Dividers 8 8 253610 = 4750 number 2536 317 39 4 0 remainders 0 (LSD) 5 7 4 (MSD)
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 Decimal Assignment ► 4750 ► 0. 6256
Octal to Binary ► 576 5 101 576 = 101111110 7 6 111 110
Octal to Binary In case of Fraction 0. 216 0. 2 010 0. 216 = 0. 010001110 1 001 6 110
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 7 5
► 11000110 011 000 110 3 0 6
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. Hexadecimal Decimal Binary 0 0 0000 1 1 0001 2 2 0010 3 3 0011 4 4 0100 5 5 0101 6 6 0110 7 7 0111 8 8 1000 9 9 1001 A 10 1010 B 11 1011 C 12 1100 D 13 1101 E 14 1110 F 15 1111
Decimal to Hexadecimal Divide the number by 16 Place reminder to the right of partial quotient obtained in step 1. 3. 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. 1. 2.
Decimal to Hexadecimal ► 741 Dividers 16 16 16 74110 = 2 E 5 number 741 46 2 0 remainders 5 (LSD) 14 i. e E 2(MSD)
Decimal to Hexadecimal ► 2536
Decimal to Hexadecimal ► In case of Fraction ► 0. 256 16 16 * * 0. 256 0. 096 0. 536 0. 576 4. 096 1. 536 8. 576 9. 216 4 1 8 9
Decimal to Hexadecimal ► 0. 3942
Decimal to Hexadecimal ► 97. 236 Integral Part Dividers 16 16 16 number 97 6 0 remainders 1 (LSD) 6 (MSD)
Decimal to Hexadecimal ► Fraction Part Multiplier 16 16 * * fraction & Partial product 0. 236 3. 776 0. 776 12. 416 0. 416 6. 656 0. 656 10. 496 3 12/C 6 10/A
Hexadecimal to Decimal ► 1 F 95 1 F 9 5 160 * 5 = 5 161 * 9 = 144 162 * F = 3840 163* 1 = 4096 8085
Hexadecimal to Decimal ► 475 C
Hexadecimal to Decimal ► 0. 48 0. 4 8 16 -1 * 4 = 0. 25 16 -2 * 8 = 0. 03125 0. 28125
Assignment ► 0. D 2 F ► 61. 3 C 6 A
Hexadecimal to Binary 59 C 5 9 C 0101 1001 1100
Hexadecimal to Binary 0. 2 D 6 0. 2 D 6 0010 1101 0110
Hexadecimal to Binary ABCD A B C D 1010 1011 1100 1101
Hexadecimal to Binary ► 11011110 1101 1110 D E
Hexadecimal to Binary ► 110000110 0001 1000 0110 1 8 6
- Slides: 56