| Integers: unsigned binary | |||||||||||||
| How many possible values are there for 32-bit unsigned binary representation? | |||||||||||||
| There are 232 different representations, so there are about 4 billion possible values | |||||||||||||
| Why 4 billion? | |||||||||||||
| Why do we say possible values? | |||||||||||||
| Minimum value: 0 | |||||||||||||
| Maximum value: 232 - 1 (approximately 4 billion) | |||||||||||||
| In general, for N bits, the max value is 2N - 1 | |||||||||||||
| Why -1, since there are 2N representations? | |||||||||||||
| Think of array of size 2N. What is the largest index? | |||||||||||||
| What is 2N? | |||||||||||||
| 1 followed by N 0's (N+1 bits). | |||||||||||||
| (22 = 100, 23 = 1000, 24 = 10000, etc.) | |||||||||||||