Comparing Decimals

Fractions & Decimals

Comparing decimals means determining which of two decimal numbers is greater, less, or equal by examining place values from left to right.

Definition

To compare decimals, line up the decimal points and compare digit by digit from left to right (from the largest place value to the smallest). The first place where the digits differ tells you which number is bigger.

Example

Compare $0.6$ and $0.58$. Line up: $0.60$ vs $0.58$. Tenths: $6$ vs $5$. Since $6 > 5$, we know $0.6 > 0.58$ right away, even though $0.58$ has more digits.

Key Insight

More digits does NOT mean a bigger decimal. $0.9$ is bigger than $0.89$ because $9$ tenths is more than $8$ tenths. Always compare from left to right, place by place.

Definition

To compare decimals $a$ and $b$: (1) compare whole-number parts first; (2) if equal, compare tenths digits; (3) continue rightward until a difference is found or both numbers are exhausted (and are equal). Appending trailing zeros ($0.6 = 0.600$) does not change value but allows digit-by-digit comparison across different lengths.

Example

Order $0.305$, $0.35$, $0.3$ from least to greatest. Rewrite with equal length: $0.305$, $0.350$, $0.300$. Compare tenths (all $3$), then hundredths ($0$, $5$, $0$), then thousandths where needed. Order: $0.300 < 0.305 < 0.350$, so $0.3 < 0.305 < 0.35$.

Key Insight

The comparison algorithm for decimals is identical to lexicographic (dictionary) ordering on the digit strings after appending enough trailing zeros. This is why database string sorts and numeric sorts can differ - "$10$" comes before "$9$" lexicographically but not numerically.

Definition

Comparing decimals is equivalent to comparing real numbers via their Cauchy sequence or Dedekind cut representations. The ordering on $\mathbb{R}$ restricts to a total order on $\mathbb{Q}$, which in decimal notation means: $x < y$ iff there exists $n$ such that $\lfloor 10^n x \rfloor < \lfloor 10^n y \rfloor$. This is consistent with the axioms of an ordered field.

Example

For irrational numbers given as decimal expansions, comparison is in principle decidable (find the first differing digit) but may require arbitrarily many digits. Comparing $\sqrt{2} = 1.41421\ldots$ with $1.4142135\ldots$ requires expanding more and more digits until a difference appears.

Key Insight

The subtlety of comparing decimals at infinite precision underlies the definition of real numbers. Two Cauchy sequences define the same real number iff their difference converges to zero - the formal version of "same decimal expansion" for the edge case where both options (like $0.999\ldots = 1.000\ldots$) represent the same real.