Math Wiki

Rounding a number means to approximate it to a similar value that has a simpler representation.

Use of rounding

1. integers to the nearest n signifiant figures - if the detail is not very important

2. numbers with decimal places - again, if the detail is not important

3. radicals and square roots - they are usually irrational, so it will be ok to round them off to a few significant figures.

4. logarithms - if the results end in a never-ending decimal

Typical situations

1. Rounding off mathematical symbols such as e or pi to several decimal places

2. Changing a fractional amount to a value with denominator with a factor other than 2 or 5 like 4/9 = 0.444444

3. Making a fraction simpler by using a smaller numerator and denominator that does not necessary equal but are very close.

4. Changing an integer or a number with a decimal point to a number with less significant digits.

5. Replacing an integer to a round number, like 101 to 100.

6. Replacing several end digits to trailing zeroes like 54325423 to 54000000.

Rounding to a Specified increment

The most common type of rounding is to round to an integer; or, more generally, to an integer multiple of some increment — such as rounding to whole tenths of seconds, hundredths of a dollar, to whole multiples of 1/2 or 1/8 inch, to whole dozens or thousands, etc..

In general, rounding a number x to a multiple of some specified increment m entails the following steps:

  1. Divide x by m, let the result be y;
  2. Round y to an integer value, call it q;
  3. Multiply q by m to obtain the rounded value z.

For example, rounding x = 2.1784 dollars to whole cents (i.e., to a multiple of 0.01) entails computing y = x/m = 2.1784/0.01 = 217.84, then rounding y to the integer q = 218, and finally computing z = q×m = 218×0.01 = 2.18.

When rounding to a predetermined number of significant digits, the increment m depends on the magnitude of the number to be rounded (or of the rounded result).

The increment m is normally a finite fraction in whatever numeral system that is used to represent the numbers. For display to humans, that usually means the decimal numeral system(that is, m is an integer times a power of 10, like 1/1000 or 25/100). For intermediate values stored in digital computers, it often means the binary numeral system (m is an integer times a power of 2).

The abstract single-argument "round()" function that returns an integer from an arbitrary real value has at least a dozen distinct concrete definitions presented in the rounding to integer section. The abstract two-argument "round()" function is formally defined here, but in many cases it is used with the implicit value m = 1 for the increment and then reduces to the equivalent abstract single-argument function, with also the same dozen distinct concrete definitions.

Rounding off to an integer

The most basic form of rounding is to replace an arbitrary number by an integer. All the following rounding modes are concrete implementations of the abstract single-argument "round()" function presented and used in the previous sections.

There are many ways of rounding a number y to an integer q. The most common ones are

  • round down (or take the floor, or round towards minus infinity): q is the largest integer that does not exceed y.
  • round up (or take the ceiling, or round towards plus infinity): q is the smallest integer that is not less than y.
  • round towards zero (or truncate, or round away from infinity): q is the integer part of y, without its fraction digits.
  • round away from zero (or round towards infinity): if y is an integer, q is y; else q is the integer that is closest to 0 and is such that y is between 0 and q.
  • round to nearest: q is the integer that is closest to y (see below for tie-breaking rules).

The first four methods are called directed rounding, as the displacements from the original number y to the rounded value q are all directed towards or away from the same limiting value (0, +∞, or −∞).

If y is positive, round-down is the same as round-towards-zero, and round-up is the same as round-away-from-zero. If y is negative, round-down is the same as round-away-from-zero, and round-up is the same as round-towards-zero. In any case, if y is integer, q is just y. The following table illustrates these rounding methods:

y round

(towards −∞)


(towards +∞)

away from
+23.67 +23 +24 +23 +24 +24
+23.50 +23 +24 +23 +24 +23 or +24
+23.35 +23 +24 +23 +24 +23
+23.00 +23 +23 +23 +23 +23
0 0 0 0 0 0
−23.00 −23 −23 −23 −23 −23
−23.35 −24 −23 −23 −24 −23
−23.50 −24 −23 −23 −24 −23 or −24
−23.67 −24 −23 −23 −24 −24

Where many calculations are done in sequence, the choice of rounding method can have a very significant effect on the result. A famous instance involved a new index set up by the Vancouver Stock Exchange in 1982. It was initially set at 1000.000, and after 22 months had fallen to about 520 — whereas stock prices had generally increased in the period. The problem was caused by the index being recalculated thousands of times daily, and always being rounded down to 3 decimal places, in such a way that the rounding errors accumulated. Recalculating with better rounding gave an index value of 1098.892 at the end of the same period.[1]