number system
TRANSCRIPT
NUMBER SYSTEM
Types
• Binary Number System
• Decimal Number System
• Octal Number System
• Hexadecimal Number System
Binary Number System• It uses only two digits. 0 & 1• These digits (o & 1) are called binary Digits or
binary numbers.• This is positional number system like Decimal
number system.• Each position has a weight that is power of 2
• 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 Number System• These are Base 10 numbers.• It is also positional number system.• We can also write numbers with fractional parts
in the system.• These numbers are from 0 to 9
Position 4 3 2 1 0 -1 -2
Face Value 5 7 2 3 1 . 2 1
Weights 104 103 102 101 100 10-1 10-2
Octal Number System• These numbers have Base 8.• These numbers are from 0 to 7.
• 751(8) is a valid Octal number but 821 can not be a member of this number system.
• 630.4(8) = 6x82 + 3x81 + 0x80 + 4x8-1 =408.5(10)
Position 2 1 0 -1
Face Value 6 3 0 . 4
Weight 82 81 80 8-1
Hexadecimal Number System• This number system uses Base 16.• Numbers are from 0 to 9 and A to F• 758(16) is different from 758(10)
• 758(10) will be called as Seven hundred and fifty eight
• But 758(16) will be called Seven Five Eight Base Sixteen.
• 758.D1(16) = 7x162 + 5x161 + 8x160 + Dx16-1 + 1x16-2 = 1880.8164(10)
Position 2 1 0 -1 -2
Face Value 7 5 8 . D 1
Weight 162 161 160 16-1 16-2
Number System Conversion
Decimal to Binary
• Convert 27 into binary
Number Remainder
2 27
2 13 1
2 6 1
2 3 0
2 1 1
0 1
= 011011(2)
Fractional Decimal to Binary
• Convert 0 . 56 into binary.
Result Fractional Part Integral Part
2 X 0.56 1.12 12 1
2 X 0.12 0.24 24 0
2 X 0.24 0.48 48 0
2 X 0.48 0.96 96 0
2 X 0.96 1.92 92 1
2 X 0.92 1.84 84 1
2 X 0.84 1.68 68 1
2 X 0.68 1.36 36 1
= 10001111(2)
Real Number into Binary• Convert 56 . 25(10) = 0111000 . 01(2)
Number Remainder
2 56
2 28 0
2 14 0
2 7 0
2 3 1
2 1 1
0 1
56=0111000(2)
Result Fractional Part Integral Part
2x0.25 0.5 5 0
2x0.5 1.0 0 1
0 . 25=01
Binary to Decimal
• Convert 011011(2) into Decimal
011011(2) = 0x25 + 1x24 + 1x23 + 0x20 + 1x21 + 1x20 = 27(10)
• Convert 1110 . 11(2) into Decimal
1110 . 11(2) = 1x23 + 1x22 + 1x21 + 0x20 + 1x2-1 + 1x2-2
8 + 4 + 2 + 0 + ½ + ¼ = 14 . 75
Decimal into Hexadecimal
• Convert 185(10) into hexadecimal
Number Remainder
16 185
16 11 9
0 B
185(10) = 0B9 (16)
Hexadecimal into Decimal
• Convert 0B9 (16) into Decimal
0B9(16) = 0x162 + Bx161 + 9x160 = 0x162 + 11x161 + 9x160 = 185(10)
• Convert 0B9.4C (16) into Decimal
0B9 . 4C(16) = 0x162 + Bx161 + 9x160 + 4x16-1 + Cx16-2
0x162 + 11x161 + 9x160 + 4x16-1 + 12x16-2
0 + 176 + 9 + 4/16 + 12/256
0 + 176 + 9 + ¼ + 3/64 = 185 . 296275(10)
Hexadecimal into Binary
• Convert 10A8(16) into Binary
• Convert each digit into Binary separately and write in 4 bits.• Step 1
– 1 = 0001(2)
– 0 = 0000(2)
– A = 1010(2)
– 8 = 1000(2)
• Step 2 : Replace each digit of Hexadecimal number with four bits obtained• 10A8(16) = 0001 0000 1010 1000 (2)
Binary to Hexadecimal
• Convert 10010011(2) into Hexadecimal
Step 1: Divide your number into groups of 4 bits starting from right side.
10010011(2) is divided into 1001 0011
Step 2: Convert each group into hexadecimal
1001 = 9(16) and 0011= 3(16)
Step 3: Replace each group by its hexadecimal equivalent
1001 0011(2) = 93(16)
Decimal into Octal
• Convert 185(10) into Octal
• Convert 0.3 (10) into Octal
R
8 185
8 23 1
8 2 7
8 0 2
185(10) = 0271(8)
8x0.3 = 2.4 0.4 2
8x0.4 = 3.2 0.2 3
8x0.2 = 1.6 0.6 1
8x0.6 = 4.8 0.8 4
8x0.8 = 6.4 0.4 6
0.3(10) = 0.23146(8)
Octal into Decimal• Convert 0271(8) into Decimal
0271(8) = 0x83 + 2x82 + 7x81 + 1x80 = 185(10)
• Convert 107(8) into Binary
Convert each digit independently into Binary
1 = 001(2)
0 = 000(2)
7 = 111(2)
107(8) = 001 000 111 (2)
Binary into Octal
• Convert 10010011(2) into Octal
Step 1: First divide the number into groups of 3 bits starting from right side.
010 , 010 and 011
Step 2: Convert each group into Octal
010(2) = 2(8) 010(2) = 2(8) 011 = 2(8)
Step 3: Replace each group by its Octal equivalent.
010 010 011(2) = 223(8)
1’s Complement Method
• Method 1: 1’s complement of an 8-bit binary number is obtained by subtracting the number from 11111111(2)
11111111
- 10011001
---------------------
1’s Complement 01100110
• Method 2: It can directly be obtained by changing all 0’s to 1’s and all 1’s to 0’s.
Original Number 01100110
1’s Complement 10011001
Representation of negative numbers using 1’s Complement
• To represent the negative number in 1’s complement form, we perform following steps.
– Determine the number of bits to represent the number– Convert the modules of the given number in Binary– Place a 0 in MSB
– Take 1’s complement of the result.