Conversion between bases.md (506B)
1 +++ 2 title = 'Conversion between bases' 3 +++ 4 # Conversion between bases 5 ## If one radix is power of other radix 6 Start right, take groups of size *ratio of powers* (e.g. hex to octal — 16 (2⁴) to 8 (2³) — 4 to 3 —convert to binary, group by 3s) 7 8 Ex: 9 10 | Binary (2¹) | grouping (1/3) | Octal (2³) | 11 | --- | --- | --- | 12 | 10100101001 | 010 100 101 001 | 2 4 5 1 | 13 14 ## If not: 15 - Binary to decimal — multiply & add up powers of 2 16 - Decimal to binary — identify powers of 2 OR repeatedly divide by 2