The model
Memory stores bit patterns; a type and an operation determine how a program interprets those bits. The same sequence can represent an integer, a floating-point value, an instruction, or encoded text. Understanding representation explains overflow, precision loss, and why serialization formats must specify byte order and field meaning.
A concrete walk-through
An unsigned w-bit integer represents values from zero through 2^w minus one. Two’s-complement signed integers reuse the same bit patterns with a different interpretation and arithmetic rules. Floating-point formats allocate bits to sign, exponent, and fraction, so many decimal fractions cannot be represented exactly.
Costs and failure cases
Integer overflow behavior differs by language and type: some environments wrap, some trap, and some make signed overflow undefined. Floating-point rounding can make algebraic rearrangements change results. Treat external bytes as untrusted until length, encoding, and numeric range have been checked.
Check your understanding
Why can a program not safely assume that adding a small decimal fraction repeatedly produces the exact mathematical result? Give one way to represent money when exact decimal arithmetic matters.