Data Representation
A bit is the smallest unit of data a computer can hold: a single 0 or 1, physically stored as one of two voltage levels inside the RAM and CPU registers the first topic in this series already introduced. Eight bits grouped together form a byte, the basic unit files and memory are actually measured in, which is why a file's size on disk — something covered in the previous topic's discussion of storage — is reported in bytes, kilobytes, or megabytes rather than in raw bits. Binary is the base-2 number system those bits literally are: just as a decimal digit can be 0 through 9, a binary digit (bit) can only be 0 or 1, so a byte like `01001101` represents a number built the same way a decimal number is, just using powers of 2 instead of powers of 10, giving a single byte a range of 256 distinct values. Hexadecimal is a base-16 shorthand that exists purely for human convenience: because exactly 4 bits can represent 16 different values (0 through 15, written as 0-9 then A-F), two hex digits map perfectly onto one byte, which is why memory addresses, color codes, and other raw byte values are almost always written in hex instead of binary — it says exactly the same thing in a fraction of the digits. Text encoding is the agreement that assigns a specific byte pattern to each character: ASCII, an early standard, used a single byte per character and covered the basic English alphabet, digits, and punctuation, while Unicode extends that idea to every writing system in the world, with UTF-8 as the most common encoding, using one byte for ordinary English text and more bytes only when a character actually needs them. An integer is a whole number stored in a fixed number of bits — commonly 32 or 64 — with that fixed width creating a real, hard boundary: once a calculation pushes a value past the largest number that width can hold, it wraps back around to a very small or negative number instead of growing further, a bug called integer overflow. A floating-point number represents values with a fractional part, using a standard called IEEE 754 that splits the available bits between the number's sign, its magnitude, and its precision — and because that precision is itself limited, a floating-point value is frequently a close approximation rather than an exact value, which is the well-known reason `0.1 + 0.2` computed on a real computer does not exactly equal `0.3`. All five of these ideas describe the exact same underlying bits interpreted in different ways: the identical byte can be read as a small integer, as two hex digits, as a character, or as part of a larger floating-point number, and which interpretation is correct depends entirely on what the program using it has been told to expect.