๐ -> 10/2/24: Dealing with Bases and Bit Representations
๐ค Vocab
โ Unit and Larger Context
Converting between bases:
Numbers are represented as powers of the base added together, and multiplied:
- Base 10:
= 235 - Base 16: 235 =
= 14 11 = E B - Base 2: 235 =
Dealing with signed ints:
Sign Magnitude vs 2โs Complement
| Bit Pattern | Unsigned Number | Sign Magnitude | 2โs Complement |
|---|---|---|---|
| 000 | 0 | +0 | 0 |
| 001 | 1 | 1 | 1 |
| 010 | 2 | 2 | 2 |
| 011 | 3 | 3 | 3 |
| 100 | 4 | -0 | -4 |
| 101 | 5 | -1 | -3 |
| 110 | 6 | -2 | -2 |
| 111 | 7 | -3 | -1 |
You are assigning a bit to the sign, so you can only represent a power of 2 less values than the unsigned equivalent
Ranges of Values
If you have
- Unsigned:
to - Sign Magnitude:
to - 2โs Complement:
to
โ๏ธ -> Scratch Notes
- Log as you go through entry
๐งช-> Example
- List examples of where entry contents can fit in a larger context
๐ -> Related Word
- Link all related words