Rounding

Arithmetic

Rounding is replacing a number with a nearby value that is simpler or less precise, based on a specified place value.

Definition

Rounding means changing a number to a nearby, simpler value. You look at the digit just to the right of the place you are rounding to: if it is $5$ or more, round up; if it is less than $5$, round down (keep the digit the same).

Example

Round $347$ to the nearest ten: look at the ones digit ($7$). Since $7 \ge 5$, round up: $350$. Round $342$ to the nearest ten: ones digit is $2$, round down: $340$.

Key Insight

Rounding makes numbers easier to work with when you do not need exact values. Prices, distances, and populations are often reported as rounded numbers.

Definition

Rounding to a specified place value replaces a number with the nearest multiple of the relevant power of $10$ (or other base). The midpoint rule: if the discarded portion is exactly half the place value, round to the nearest even digit (banker's rounding) or always round up (standard rounding).

Example

Round $3.14159$ to $3$ decimal places: the $4$th decimal is $5$, so round up the $3$rd: $3.142$. Round $2.345$ using banker's rounding: the $3$rd decimal ties between $4$ and $5$; since $4$ is even, keep it: $2.344$.

Key Insight

Banker's rounding (round half to even) is standard in financial and scientific computing because it minimizes systematic bias when many values are rounded. Standard rounding (round half up) introduces a slight upward bias.

Definition

Rounding corresponds to a projection from $\mathbb{R}$ to a discrete subset such as $10^{-k} \cdot \mathbb{Z}$. Rounding error analysis is central to numerical analysis: the IEEE 754 floating-point standard specifies that each operation is rounded to the nearest representable value, with a relative error bounded by the machine epsilon $\varepsilon = 2^{-52}$ for double precision.

Example

Accumulated rounding errors can cause catastrophic cancellation: computing $(1 + 10^{-16}) - 1$ in double precision returns $0$ because $1 + 10^{-16}$ rounds to $1.0000000000000002$, and the subtraction loses all significant digits.

Key Insight

Kahan summation algorithm compensates for rounding error in large sums by tracking a running compensation term. This can improve accuracy from $O(n \cdot \varepsilon)$ to $O(\varepsilon)$ for summing $n$ floating-point numbers.