Rounding - Rounding To A Specified Increment

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 number system that is used to represent the numbers. For display to humans, that usually means the decimal number 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 number 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.

Read more about this topic:  Rounding

Famous quotes containing the word rounding:

    People forget that it is the eye that makes the horizon, and the rounding mind’s eye which makes this or that man a type or representative of humanity with the name of hero or saint.
    Ralph Waldo Emerson (1803–1882)