Number Systems
Number Systems
TOPICS
It sounds complicated ?
Decimal Number Systems
100=1
Decimal Number Systems
• Example
• Example
• Summary
• In the decimal system, there are 10 digits (0
through 9) which combine to form numbers as
follows:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
19 20 21 22 ...
Binary Number Systems
• The term computer numbering formats refers to
the schemes implemented in digital computer and
calculator hardware and software to represent
numbers
• Digital Computers and Calculator use a binary
systems
• Why binary?
Binary Number Systems
• Easy to represent binary values electrically
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
Convert Decimal to Binary
For Each Digit Position
1 0 1 1
Bit 3 Bit 2 Bit 1 Bit 0
Convert Binary to Decimal
Example: Convert 11012
Bit7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
1 1 0 1
Multiply with 8 x 1 + 4 x 1 + 2 x 0 + 1x 1 = 8 + 4 + 0 + 1
these values
= 13
Binary Number Systems
Example:
10112 or 1011 B
= 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20
= 8 + 0 + 2 +1
= 1110
Binary Number Systems
Example:
101102 or 10110 B
1 x 24+0 x 23 + 1 x 22 + 1 x 21 + 0 x 20
= 16 + 0 + 4 +2+0
= 2210
Other Number Systems
• 1001001101010001
is tedious, and prone to errors.
• Therefore, binary quantities are written in a
base-8 ("octal") or, much more commonly, a
base-16 ("hexadecimal" or "hex") number
format.
Octal Number Systems
Digit 3 Digit 2
3 x 82 + 2 x 81 + 5 x 80 = 3 x 64 + 2 x 8 + 5 x 1
= 192 +16 + 5
= 213
Octal Number Systems
• Example Convert 6118
• Consider the above number
6 1 1 (8) Digit 1
Digit 3 Digit 2
6 x 82 + 1 x 81 + 1 x 80 = 6 x 64 + 1 x 8 + 1 x 1
= 384 + 8 + 1
= 393
Octal Number Systems
• Convert 393 to octal
Answer = 6118
Hexadecimal Number
Systems
• Base = 16 or ‘H’ or ‘Hex’
16 symbols: { 0, 1, 2, 3, 4, 5, 6, 7,8,9 }
Answer = D516
Hex Number Systems
• How to convert D516 back to Decimal ?
• Use this table and multiply the digits with the position
values
Digit Digit Digit Digit Digit Digit Digit Digit
8 7 6 5 4 3 2 1
167 166 165 164 163 162 161 160
Digit 2
D x 161 + 5 x 160 = 13 x 16 + 5 x 1
= 208 + 5
= 213
Binary Number Systems
• A single bit can represent two states:0 1
• Therefore, if you take two bits, you can use them
to represent four unique states:
00, 01, 10, & 11
• And, if you have three bits, then you can use them
to represent eight unique states:
000, 001, 010, 011, 100, 101, 110, & 111
Binary Number Systems
•And, if you have three bits, then you can use them
to represent eight unique states:
These have a perfect correspondence to Octal
000 = Octal 0 100 = Octal 4
001 = Octal 1 101 = Octal 5
010 = Octal 2 110 = Octal 6
011 = Octal 3 111 = Octal 7
Binary Number Systems
0.1012
101
0.1012 = (1 * 2-1) + (0 * 2-
2
) + (1 * 2-3)
1012 = (1 * 22) + (0 * 21) + (1 or
* 20) 0.1012 = (1 * 1/2) + (0 *
or alternatively: 1/4) + (1 * 1/8)
1012 = (1 * 4) + (0 * 2) + (1 * or
1) = 510 0.1012 = (1 * 0.5) + (0 *
0.25) + (1 * 0.125) =
0.62510
Fractional decimal to Binary
• Example 910 = (1 * 23) + (0 * 22) + (0 * 21) + (1
* 20) = 10012
9.12510
Or
910 = (1 * 8) + (0 * 4) + (0 * 2) + (1 * 1) =
10012
Step 1 ---------- We multiply 0.125 by 2 and take the integer
part 0.125 x 2 = 0.250 Integer part = 0 Fractional part = 0.250
As, fractional part is not equal to 0
Step 2 ---------- We multiply 0.250 by 2 and take the integer
part 0.250 x 2 = 0.5 Integer part = 0 Fractional part = 0.5 As,
fractional part is not equal to 0
Step 3 ---------- We multiply 0.5 by 2 and take the integer part
0.5 x 2 = 1 Integer part = 1 Fractional part = 0.0 As, fractional
part is equal to 0 so we stop here
Fractional decimal to Binary
• 9.12510 = 1001.0012
Fractional decimal to Binary
Fractional decimal to Binary
The method of repeated multiplication by 2 has to be used to convert such kind of decimal fractions.
Step 2: Discard the integer part of the previous product. Multiply the fractional part of the previous
product by 2. Repeat Step 1 until the same fraction repeats or terminates (0).
Step 3: The resulting integer part forms a sequence of 0s and 1s that become the binary equivalent of
decimal fraction.
Step 4: The final answer is to be written from first integer part obtained till the last integer part obtained.
Write the intger parts from top to bottom to obtain the equivalent fractional
binary number. Hence (0.2)10=(0.00110011…)2 = (0.00110011)2
Fractional decimal to Binary
Write the intger parts from top to bottom to obtain the equivalent fractional
binary number. Hence (0.2)10=(0.00110011…)2 = (0.00110011)2
End