Binary Conversion
Decimal to Binary
Example: Convert the decimal number 105 into the binary number 01101001 as a binary string of 8 bits
|
Remainders |
105 |
|
52 |
1 |
26 |
0 |
13 |
0 |
6 |
1 |
3 |
0 |
1 |
1 |
0 |
1 |
0 |
0 |
Answer is: 105 base 10 = 01101001 base 2
Binary to Decimal
Binary |
0 |
1 |
1 |
0 |
1 |
0 |
0 |
1 |
|
Position |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
|
Weight |
128 |
64 |
32 |
16 |
8 |
4 |
2 |
1 |
|
Add em |
|
64 |
32 |
|
8 |
|
|
1 |
= 105 |
What is the largest natural number you can represent using n bits?
· Base 2: 111 11 base 2
· Base 10: 2n-1 + 2n-2 + + 21 + 20 base 10 = 2n 1