Binary — a Practical Guide
A practical guide to bits, bytes, numbers, endianness, floating point, binary I/O, checksums, and common pitfalls—with copy‑paste toolkits for Python , Go , and JavaScript at the end. 1) Bits, bytes, bases bit : 0 or 1 byte : 8 bits (most systems are byte-addressable) bases : binary 0b1010 , hex 0xA , decimal 10 nibble : 4 bits → maps cleanly to 1 hex digit Binary ↔ hex head math (nibbles): bin 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 hex 0 1 2 3 4 5 6 7 8 9 A B C D E F KB vs KiB KB/MB/GB (SI): 10³, 10⁶, 10⁹ KiB/MiB/GiB (binary): 2¹⁰, 2²⁰, 2³⁰ 2) Integers: unsigned, signed, two’s complement unsigned n‑bit range: 0 … (2ⁿ−1) (8‑bit: 0..255 ) two’s complement (signed) range: −2ⁿ⁻¹ … 2ⁿ⁻¹−1 (8‑bit: −128..127 ) Negation in two’s complement: invert bits + 1 Bitwise operation...