Binary Math

December 21, 2023 note-to-self

Binary Math

Binary math is base 2. Our normal everyday numbering system is a base 10.

Instead of 10 numbers (0-9), you can only have a value of 0 or 1.

Take 00101101 = (0 * 2^7) + (0 * 2^6) + (1 * 2^5) + (0 * 2^4) + (1 * 2^3) + (1 * 2^2) + (0 * 2^1) + (1 * 2^0) = 0 + 0 + 0 + 32 + 8 + 4 + 0 + 1 = 45

0 - (0 * 128) = 0 0 - (0 * 64) = 0 1 - (1 * 32) = 32 0 - (0 * 16) = 0 1 - (1 * 8) = 8 1 - (1 * 4) = 4 0 - (0 * 2) = 0 1 - (1 * 1) = 1

Add those all up together 32 + 8 + 4 + 1 and you get 45.

Most posts are for my own reference and reflection, and shouldn’t be taken as fully accurate or instructional.