Computer Organization - Lecture 8.0
Computer Organization - Lecture 8.0
Byte 1 Byte 2
0 1 2 3 4 5 6 7 8 9 AB CD E F
Number Systems
Number Systems
Generic Rule
For a number of any Base N
There are N Digits: 0, 1, 2, 3, 4, 5, …, N-1
Nn-1 … N3 N2 N1 No
dn-1 … d3 d2 d1 do
last bit
32,768 16,384 8192 4096 2048 1024 512 256
128 64 32 16 8 4 2 1
first bit
Example – Binary Number
10002 = 1 x 8 + 0 x 4 + 0 x 2 + 0 x 1 = 810
10112 = 1 x 8 + 0 x 4 + 1 x 2 + 1 x 1 = 1110
Number base
Counting in Binary
• Because the Binary uses base 2 as opposed to the
Decimal base 10, the numbers get larger (longer)
much more quickly, but they still obey the same
principles in terms of columns.
• In Decimal, the number “Ten” is represented by
10 (one 10s and no 1s)
• In Binary, the number “Ten” is represented by
1010 (one 8s, no 4s, one 2s and no 1s).
Decimal to Binary Conversion
Positional Method
In the positional method, we sum the
values according to their positions
Binary to Decimal Conversion
Example 1: Positional Method
To convert the binary string 100112 to decimal, we write out the
relevant columns and put the binary string underneath. Then, we add
together the columns where the 1’s are located.
Units 16 8 4 2 1
Binary 1 0 0 1 1
In this case, the 1’s are located under the units columns of 16, 2 and 1.
We add these together to get 16+2+1 = 19. So, 100112 is equal to 1910
Binary to Decimal Conversion
Example 2: Positional Method
Converting 1010011012 to decimal
Units 256 128 64 32 16 8 4 2 1
Binary 1 0 1 0 0 1 1 0 1
Doubling Method
• Convenient for large binary numbers
• Starting with the left-most digit of the given binary number,
for each digit as you move to the right, double the previous
total and add the current digit (Note: the initial total is zero).
Binary to Decimal Conversion
Example 1: Doubling Method
To convert the binary string 10012 to decimal:
Attention
Higher risk of error: Mistakes could
be made when you move from left
to right.
Next lecture
• Continuation of Number Systems
• Hexadecimal Numbers
• Numbers Conversion