By means of place value systems, natural numbers can be represented as sequences of digits. Using such representations, two natural numbers can be compared, i.e. it can be calculated whether the number represented by one sequence of digits is smaller than the other. If two natural numbers
and
each represented by their digit sequences without leading zeros in a place value system, then
if
- the sequence of digits for
is shorter than that for
or - both are of equal length and the digit sequence to is
lexicographically smaller than that to 
The lexicographic comparison is based on the comparison of one-digit numbers. By means of place value systems, natural numbers are also represented in modern digital calculators, on the basis of which comparisons are possible. The numbers that arithmetic-logic units of such computers can deal with directly have fixed magnitudes, i.e. they contain leading zeros, so that a comparison according to the lexicographic order is possible. Directly by means of the above definition of order, comparisons of arbitrary integers or rational numbers can also be calculated. When representing rational numbers in scientific notation, two numbers can be compared by first comparing the exponent and then, if the exponent is the same for both, the mantissa. This is especially true for floating point numbers representing dyadic fractions, which are often used on digital computers for calculations - especially approximate calculations. Many processors (such as those based on x86) provide their own instructions for comparing integer and floating point numbers.
Since the real numbers form a supra-countable set, there is no scheme according to which all real numbers can be represented. Thus, the question of a general calculation rule for comparison is also superfluous. An important basic approach is to represent certain real numbers by calculation rules that can calculate arbitrarily precise upper and lower bounds for the number in the form of rational numbers, for example by calculating further decimal places step by step. This leads to the concept of a calculable number. Two different computable numbers can be compared by calculating increasingly precise upper and lower bounds for both until the two intervals are separated (cf. interval arithmetic). On the other hand, the equality of two numbers represented in this way cannot be calculated, so the other comparisons cannot be calculated for possibly equal numbers either. For many applications it is sufficient, for example in numerical analysis, to allow a tolerance, i.e. the comparison is carried out correctly as long as the distance between the two numbers is greater than a fixed tolerance, which can be arbitrarily small, otherwise the numbers are regarded as equal. Such a comparison is computable for general computable numbers. In important special cases, on the other hand, an exact comparison is also possible: Algebraic numbers can be represented by polynomials with integer coefficients, whose zero they are, and an interval with rational minimum and maximum, which determines the respective zero. In an algebraic way, it is now possible to determine for two numbers represented in this way whether they are equal by determining common zeros. These are just determined by the greatest common divisor of the two polynomials. In the case of inequality, the comparison can then again be carried out via upper and lower bounds. These also make it possible to dispense with the algebraic calculation if the inequality has already been proven by calculated bounds. Assuming that Schanuel's hitherto unproven conjecture holds, an algorithm was also constructed that calculates comparisons for numbers that are given as zeros of systems of equations that may contain elementary functions. For algebraic numbers that are given as square root expressions or as zeros of low-degree polynomials, special procedures for comparison exist.
Such methods for exact comparisons are used in computer algebra systems and algorithmic geometry.