Binary to decimal
Every column's worth is 2 raised to its index, counting from 0 on the rightmost column: index 0 is worth 2^0 = 1, index 1 is worth 2^1 = 2, index 2 is worth 2^2 = 4, and so on. To turn binary into decimal, add up the worth of every column that holds a 1. Take 1011:
| Bit | 1 | 0 | 1 | 1 |
|---|---|---|---|---|
| Index | 3 | 2 | 1 | 0 |
| Worth (2^index) | 8 | 4 | 2 | 1 |
| Count it? | yes | no | yes | yes |
8 + 2 + 1 = 11. So 1011 in binary is 11 in decimal. A 1 earns its column's value, a 0 earns nothing. The same method works at any width: keep raising 2 to the next index as you move left.
