Comparing 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. More precisely, compare whole-number parts first, then tenths, then hundredths, and so on, continuing rightward until a difference is found (appending trailing zeros like $0.6 = 0.600$ lets you compare numbers of different length digit by digit). This is equivalent to comparing real numbers via their Cauchy sequence or Dedekind cut representations: $x < y$ iff there exists $n$ such that $\lfloor 10^n x \rfloor < \lfloor 10^n y \rfloor$, consistent with the axioms of an ordered field.
Example
Compare $0.6$ and $0.58$ by lining them up as $0.60$ vs $0.58$: the tenths digits are $6$ vs $5$, so $0.6 > 0.58$ immediately, even though $0.58$ has more digits. Ordering $0.305$, $0.35$, $0.3$ from least to greatest: rewritten as $0.300$, $0.350$, $0.305$, comparing tenths (all $3$), then hundredths, gives $0.3 < 0.305 < 0.35$. For irrational numbers given as decimal expansions, comparison can require arbitrarily many digits: comparing $\sqrt{2} = 1.41421\ldots$ with $1.4142135\ldots$ means expanding more and more digits until a difference finally appears.
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, so always compare from left to right, place by place. The comparison algorithm for decimals is identical to lexicographic (dictionary) ordering on the digit strings after appending enough trailing zeros, which is why database string sorts and numeric sorts can differ, "10" comes before "9" lexicographically but not numerically. 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 edge cases like $0.999\ldots = 1.000\ldots$.