# Rounding

The rounding or the rounds is the replacement of a number by a proxy , the desired properties, which are missing the original number.

One rounds to

• Make numbers with decimal places easier to read;
• to adhere to the limited number of representable digits (also with floating point numbers );
• to indicate the value of irrational numbers at least approximately, such as the circle number ;${\ displaystyle \ pi}$
• to take into account the accuracy of a result and thereby avoid fictitious accuracy ; not only are decimal places rounded, but also large whole numbers without shortening the representation. For example, the Federal Employment Agency rounds the calculated number of unemployed to a full 100. Here, the number of digits shown remains unchanged, but the last two digits are indicated as not significant ;
• to adapt a given number to the unit that can be represented or used . Examples are the smallest coin for cash, the smallest arithmetical currency unit for book money, whole grams for kitchen scales, and entire mandates for proportional representation for seat allocation procedures .

If a positive number is increased, one speaks of "rounding up"; if it is made smaller, “round off”. In the case of negative numbers, these words are ambiguous. If only decimal places are left out, one speaks of "cut off".

The "approximately equal" (  ) sign  can indicate that the following number is rounded. It was introduced by Alfred George Greenhill in 1892 .

## Rounding rules

### Commercial rounding

The Commercial rounds (not negative numbers) is as follows:

• If the number in the first decimal place is 0, 1, 2, 3 or 4, then it is rounded down.
• If the number in the first decimal place is a 5, 6, 7, 8 or 9, then it is rounded up.

This rounding rule is described by the DIN 1333 standard . Rounding is often taught in elementary school.

Examples (rounding to two decimal places):

• 13.3749 ... € ≈ 13.37 €
• 13.3750 ... € ≈ 13.38 €

Negative numbers are according to their magnitude rounded, at a 5 to say away from zero ( engl : Away from Zero ):

• −13.3749 ... € ≈ −13.37 €
• −13.3750 ... € ≈ −13.38 €

The Commercial rounds is partially in the legal environment as Civil rounds called and z. B. in Section 14 of the Civil Service Pension Act as follows:

"The pension rate is to be calculated to two decimal places. The second decimal place must be increased by one if one of the digits five to nine would remain in the third place. "

### Symmetrical rounding

Commercial and symmetrical rounding differ from each other only in where a number is rounded exactly in the middle between two numbers with the selected number of decimal digits.

The symmetrical (or geodetic, mathematical, undistorted, scientific ) rounding is defined as follows (formulation adapted):

1. If the number in the first decimal place is 0, 1, 2, 3 or 4, it is rounded down.
2. If the number is a 5 (followed by further numbers that are not all zero), 6, 7, 8 or 9 in the first decimal place, it is rounded up.
3. If the digit in the first decimal place to be omitted is only a 5 (or a 5 followed by only zeros), it is rounded off in such a way that the last digit to be retained is even.

This type of rounding is used in numerical math , engineering, and technology. It is provided in the IEEE-754 standard for calculating with binary floating point numbers in computers. In English literature it is called Round to Even or Banker's Rounding .

Examples (rounding to one decimal place):

• 2.2499 ≈ 2.2 (according to rule 1)
• 2.2501 ≈ 2.3 (according to rule 2)
• 2.2500 ≈ 2.2 (rounded to an even number according to rule 3)
• 2.3500 ≈ 2.4 (rounded to an even number according to rule 3)

The commercial rounding creates small systematic errors, since rounding up by 0.5 occurs, but rounding down by 0.5 never occurs; this can skew statistics slightly. The mathematical rounding always rounds up or down from the exact middle between two digits to the next even digit. As a result, the average is rounded up and down roughly as often, at least if the original numbers are stochastic . (Counterexample: if small numbers are more common than large ones, they can systematically be rounded down more often than up, see Benford's law .)

### Sum preserving rounding

In the case of sum-preserving rounding, the addends are rounded so that their sum is equal to the rounded sum of the addends. It may be necessary to round some summands away from the nearest rounded value to the opposite value.

Important applications are the allocation of seats in proportional representation and the allocation of the entire VAT in an invoice to its individual items.

The case that all summands are positive has been thoroughly researched, see seat allocation procedure .

The Hare-Niemeyer method there can be generalized for summands with both signs : All numbers are rounded to the nearest round numbers, and as long as the sum is too large (or too small), one of the rounded up (or rounded) numbers is chosen the one with the greatest rounding up (or the greatest amount of rounding down) and changes its rounding in the opposite direction. This makes the sum of the amounts of the changes minimal .

## Dealing with rounded numbers

### Rounding numbers that have already been rounded

If the initial number is already the result of rounding, then for the borderline case that the new rounding digit is 5 (and all digits after that zero), the unrounded number must be used if possible (e.g. with mathematical constants):

• Unrounded number known: 13.374999747, rounded starting number: 13.3750
→ rounded number: 13.37
• Unrounded number unknown, rounded starting number: 13.3750
→ rounded number: 13.38.

### Identification of rounding results

In scientific papers and logarithm tables , it is sometimes indicated whether the last digit was obtained by rounding up or down. A number that was obtained by rounding up is indicated by a line under (or above) the number, a number that has not been changed by the rounding (the number has been rounded off) is marked with a point above the number .

Examples:

• ${\ displaystyle 3 {,} 4134928 ...}$becomes to ; this number is the new rounds . When rounding again (in the example to three places after the decimal point), it must be rounded down.${\ displaystyle 3 {,} 413 {\ underline {5}}}$${\ displaystyle 3 {,} 413}$
• ${\ displaystyle 2 {,} 6245241 ...}$becomes to ; this number becomes clearer the next time you round it to . When rounding again (in the example to three places after the decimal point), you have to round up. For further rounding (here to two places) it would be rounded down, indicated by 5 .${\ displaystyle 2 {,} 624 {\ dot {5}}}$${\ displaystyle 2 {,} 625}$${\ displaystyle 2 {,} 62 {\ underline {5}}}$

If no other digits are known, the starting number is assumed to be exact.

### Calculate with rounded numbers

If rounded numbers are included in a calculation, the final result must be rounded to the same number of significant digits. If z. For example, if a force of 12.2 Newtons is measured, then all final results that depend on this force must be rounded so that a maximum of three significant digits remain. In this way, the reader is not pretended to be more precise than what is actually available.

## Formal rounding rules

Commercial rounding in particular is explained in a way that children can understand. For this, you just have prices of goods and salaries know in the point notation. Even in the chapter "Elementary Mathematics" of the Mathematics Pocket Book by Bronstein / Semendjajew, somewhat more complicated rounding rules are formulated without the aid of deeper mathematical expressions, but accompanied by mathematical explanations. This section discusses some of these and some other mathematical considerations.

### Finite and infinite sequences of digits

Bronstein / Semendjajew discuss rounding up or down on the basis of formal numerals - strings in a (decimal) place value system , not to be confused with the part of speech . Positive decimal fractions (in the strict sense, ) can be used as ${\ displaystyle {\ frac {a} {10 ^ {n}}}}$${\ displaystyle a, n \ in \ mathbb {N}}$

${\ displaystyle z_ {v} z_ {v-1} \ ldots z_ {0}, z _ {- 1} z _ {- 2} \ ldots z _ {- n}}$

written (or vice versa). There are places before the comma (general separator ) and places after. are out of the numeric stock { , , , , , , , , , }. ${\ displaystyle v}$${\ displaystyle n}$${\ displaystyle z_ {v}, \ ldots, z _ {- n}}$0123456789

Other positive real numbers can decimal fractions (as approximate) with arbitrary precision approximated will see. Representations of different types of numbers and development of decimal fractions . The coefficients of the decimal fraction expansion

${\ displaystyle \ sum _ {i = v} ^ {\ infty} a_ {i} 10 ^ {i}}$

Such a number then results in an infinitely long sequence of digits (interrupted by a comma or separator) . The number is the digit value of - has the digit value , has the digit value , etc. With ${\ displaystyle x}$${\ displaystyle z_ {v} z_ {v-1} \ ldots z_ {0}, z _ {- 1} \ ldots}$ ${\ displaystyle a_ {i}}$${\ displaystyle z_ {i}}$0${\ displaystyle 0}$1${\ displaystyle 1}$

${\ displaystyle A (j): = \ sum _ {i = v} ^ {- j} a_ {i} 10 ^ {i} \ qquad (j \ geq -v)}$

the sequence of approximate values ​​increases monotonically and is limited by upwards . Even more: the termination error tends towards 0, thus converging towards . Is ${\ displaystyle A (j)}$ ${\ displaystyle x}$ ${\ displaystyle xA (j) \ leq 10 ^ {- j}}$ ${\ displaystyle A (j)}$${\ displaystyle x}$

${\ displaystyle Z (j): = z_ {v} \ ldots z_ {0}, z _ {- 1} \ ldots z _ {- j}}$

each the representing character string, so for the character string is a prefix of the character string , of the infinitely long, representing character string - casually  - it is something similar, Bronstein / Semendjajew informally call it a “ beginning part ” of the latter. The same as for can be said of (comma and decimal places are missing). ${\ displaystyle A (j)}$${\ displaystyle 1 \ leq k \ leq l}$${\ displaystyle Z (k)}$${\ displaystyle Z (l)}$${\ displaystyle x}$${\ displaystyle Z (\ infty)}$${\ displaystyle Z (k)}$${\ displaystyle Z (0): = z_ {v} \ ldots z_ {0}}$

The statements about and also apply if can be represented by a finite character string with decimal places. In this case are for the coefficients and the digits . This approach is also helpful for the formulation of rounding rules. ${\ displaystyle A (j)}$${\ displaystyle Z (j)}$${\ displaystyle x}$${\ displaystyle n}$${\ displaystyle z _ {- 1} \ ldots z _ {- n}}$${\ displaystyle i> n}$${\ displaystyle a_ {i} = 0}$${\ displaystyle z_ {i}}$ 0

For negative numbers, the same applies with a preceding minus sign , etc. (the sequence of approximate values ​​falls ...).

With different sets of digits and different criteria for the representability by finite character strings, the above also applies to place value systems to other bases instead of 10. Base 10 is commonplace if you are not (professionally) concerned with the implementation of rounding in the computer , where powers of 2 serve as bases.

The widely popular dot notation is formally defined as recursive as follows ( stands for the concatenation of character strings, for the empty character string ): ${\ displaystyle z _ {- 1} ... z _ {- j}}$${\ displaystyle \ circ}$${\ displaystyle \ varepsilon}$

${\ displaystyle z _ {- 1} \ ldots z _ {- 0} = \ varepsilon; \ qquad z _ {- 1} \ ldots z _ {- (j + 1)} = z _ {- 1} \ ldots z _ {- j} \ circ (z _ {- (j + 1)}) \ quad (j \ in \ mathbb {N} _ {0}).}$

### "Cut off" / "Cancel"

Truncation or abortion / abortion after the -th decimal place of a number, of which decimal places are known, means that the “numerical word” is replaced by “approximation”, in the notation used above with . So one uses a prefix or a "beginning part" of a more precise character string. This is the case , for example, when, for a number that cannot be represented with a finite number of digits, the first decimal places are determined one after the other and no further digits - in this case, however, the number represented by is an approximation for . However, knowledge of (at least) is required for mathematical rounding to the -th decimal place . ${\ displaystyle b}$${\ displaystyle n \ geq b}$${\ displaystyle z_ {v} \ ldots z_ {0}, z _ {- 1} \ ldots z _ {- n} \ ldots}$${\ displaystyle z_ {v} \ ldots z_ {0}, z_ {v + 1} \ ldots z _ {- b}}$${\ displaystyle Z (n)}$${\ displaystyle Z (b)}$${\ displaystyle b = n}$${\ displaystyle n}$${\ displaystyle Z (b)}$${\ displaystyle x}$${\ displaystyle b}$${\ displaystyle z _ {- b-1}}$

Canceling a number with decimal places - e.g. B. calculated from measured values ​​or read from the measuring device - decimal places can be useful when calculating with rounded numbers , or if you know that the device shows decimal places, but can only measure reliably from them. ${\ displaystyle n> b}$${\ displaystyle b}$${\ displaystyle n}$${\ displaystyle b}$

### Round off

The Gaussian bracket  : also known as the Gaussian, integer or rounding function , maps every real number to the largest integer that is not greater than the real number. ${\ displaystyle \ lfloor ... \ rfloor}$

Conclusions:

• The Gaussian function does not change the sign , but can map a positive number to zero.
• For positive numbers in digit notation, the use of the Gaussian function is identical to cutting off the decimal places (including the comma).
• For every negative non-integer , the magnitude of the function value is greater than the magnitude of the input number.

In order to round off a positive non-integer number in digits so that only the -th decimal place is retained (it is rounded down to the -th place after the decimal point), you simply cut off the other decimal places . In the decimal system, the value rounded off to the -th decimal place using the Gaussian brackets${\ displaystyle x}$${\ displaystyle b}$${\ displaystyle b}$${\ displaystyle x}$${\ displaystyle b}$

${\ displaystyle {\ frac {\ lfloor 10 ^ {b} \ cdot x \ rfloor} {10 ^ {b}}} = \ lfloor 10 ^ {b} \ cdot x \ rfloor \ cdot 10 ^ {- b}}$.

### Round up

The counterpart to the Gaussian bracket function is the rounding function (also called the upper Gaussian bracket ), that of a real number is the whole number ${\ displaystyle x}$

${\ displaystyle \ lceil x \ rceil: = \ min \ {y \ in \ mathbb {Z} \ mid y \ geq x \}}$

assigns. The value of a positive real number rounded up to the -th decimal place is . ${\ displaystyle b}$${\ displaystyle x}$${\ displaystyle \ lceil 10 ^ {b} \ cdot x \ rceil \ cdot 10 ^ {- b}}$

## Rounding in the computer

Since floating point numbers in the computer only occupy a certain, finite memory area, the accuracy is limited by the system. After mathematical operations (such as multiplication), numbers are also usually produced that would require greater precision. In order to still be able to show the result, it must be rounded in some way so that the number fits into the intended number format (e.g. IEEE 754 ).

The simplest rounding scheme is the cutting (engl. Truncation or chopping ): A number of a particular point to the left to stand, dropped the rest. This rounds it down to the nearest possible number. For example, if you round to zero decimal places, a . This method is very fast, but it suffers from a relatively large rounding error (in the example it is ). However, clipping is an indispensable method in digital signal processing . It is the only method that can reliably prevent an unstable limit cycle due to rounding errors in digital filters . ${\ displaystyle 10 {,} 11_ {2} = 2 {,} 75_ {10}}$${\ displaystyle 10_ {2} = 2_ {10}}$${\ displaystyle 0 {,} 75_ {10}}$

Commercial rounding is also used as a further rounding scheme ( round-to-nearest ). Before rounding, you add to the number to be rounded and then cut off. In the example this would mean that it will be cut off . The error here is only . However, this rounding is positively distorted. ${\ displaystyle 0 {,} 1_ {2} = 0 {,} 5_ {10}}$${\ displaystyle 2 {,} 75_ {10} +0 {,} 5_ {10} = 3 {,} 25_ {10} = 11 {,} 01_ {2}}$${\ displaystyle 11_ {2} = 3_ {10}}$${\ displaystyle 0 {,} 01_ {2} = 0 {,} 25_ {10}}$

Therefore, one takes into account mathematical rounding ( English round-to-nearest-even ), which rounds to the next even number for numbers that end in. This rounding procedure is provided for in the IEEE 754 standard. Alternatively, also rounded to the nearest odd number ( English round-to-nearest-odd ). ${\ displaystyle \ ldots {,} \ ldots 5_ {10} = \ ldots {,} \ ldots 1_ {2}}$

Even though mathematical rounding performs well numerically, it still requires complete addition since the carry bit wanders through all digits of the number in the worst case. It therefore has a relatively poor runtime performance. A ready-made table that contains the rounded results, which only need to be called up, is a possible way around this problem.