Rounding

Rounding is an arithmetic operation in which a number in positional notation, usually a decimal number, is replaced by a number with a smaller number of significant figures ( of meaningful ) locations. Here, the difference between the original and rounded number, the rounding errors as small as possible is maintained.

Basics

Purpose of rounding is

  • To save space for the representation, especially in decimal fractions and floating point numbers, or
  • Adjust the number of digits of accuracy of a calculation result (see error calculation)
  • Adjust the accuracy of the result of displayable or measurable unit ( smallest possible unit of currency eg cents, whole gram at kitchen scales, ... ).

Usually you decrease the number of decimal places and thus the number of digits shown. But even large integers are rounded. For example, the Federal Employment Agency completes the calculated number of unemployed to full 100 Here the number of digits shown remains unchanged, but the last two digits will be marked as not significant.

When a positive number increases, this is called rounding up, it will be reduced by rounding. For negative numbers, these words are ambiguous. If only decimal omitted, it is called truncation.

Rounding changed, in most cases the value of the rounded number. Conventional rounding methods can be classified according to the direction:

  • Down
  • Toward zero
  • Rounding to the nearest number.

Commercial rounding

The Commercial rounds is as follows:

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

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

(each rounded to two decimal places): * 13.3749 € 13.37 ... € ≈ * 13.3750 € 13.38 ... € ≈ Negative numbers are rounded according to their magnitude, at a 5 ie, away from zero: * -13.3749 ... € ≈ € -13.37 * -13.3750 ... € ≈ € -13.38 Rounds already rounded figures

If the original number is already the result of rounding, it must for the limiting case that the new rounding place is 5 (zeros and all points thereafter), if possible recourse to the exact number ( for example in mathematical constants ):

* Exact number known: 13.374999747, rounded output number: 13.3750 → round number: 13.37 * Exact number unknown, rounded output number: 13.3750 → round number: 13.38. Labeling of rounding results

In scientific work and the logarithm is sometimes indicated if the last digit is obtained by rounding up or down. A number obtained by rounding is marked with a line under (or above ) the number, a number that has not changed through the rounds (the number was so rounded ), is marked with a dot above the number.

* Will result; this number is when re- rounds. The next time round (in the example to three places after the decimal point ) so has to be rounded. * Will result; this number is when re- rounds, clearly. The next time round (in the example to three places after the decimal point ) is thus rounded up. For further rounds (here on two points ) would round off, as indicated by 5 If there are no other locations are known, the initial number is assumed to be exact.

Mathematical rounds

The Mathematical (also geodetic or undistorted ) Rounding is defined as follows:

This kind of rounding is used in mathematics and engineering. It is provided in the IEEE -754 standard for binary floating-point calculations with computers. Other names for this type of rounding is symmetric Scientific or rounds; in English-language literature Round to Even or banker 's rounding.

Examples ( rounded to one decimal place ):

  • 2.2499 ≈ 2.2 ( by rule 1)
  • 2.2501 ≈ 2.3 ( by rule 2)
  • 2.2500 ≈ 2.2 ( in accordance with Rule 3 for even number rounded down )
  • 2.3500 ≈ 2.4 ( in accordance with Rule 3 for even number rounded down )

Commercial and undistorted mathematical rounds only in where a number is rounded exactly in the middle between two numbers with the selected number of decimal digits differ.

The ampersand rounds produces small systematic error because the rounding up to 0.5 occurs, rounding to 0.5 but never; which can distort statistics slightly.

The mathematically unbiased rounding (English round to even ) rounds from the exact center between two numbers up or down to the nearest even number always. This as often as on - rounded and the above-mentioned systematic error is avoided in the middle.

Sum Conservatory rounds

In sum preserving rounds the part amounts are rounded such that the sum of the rounded part amounts to the sum of the original amounts equivalent. This approach is necessary, for example, if the VAT amounts are listed on an invoice of each item individually. Since the sum of the rounded tax amounts for the items should correspond to the value-added tax from the sum of the net amounts, is sum preserving rounds imperative here.

One possible implementation is the carrying of the accumulated rounding error: When rounding the first number, a rounding error occurs. The rounding error is added before rounding the second number to it. The new rounding error is then the difference of this sum to its rounded value. This procedure assumes you continue up to the last number. The cumulative error is always in the interval. The method is simple, but statistically not optimal because the first number is treated differently than the following. Other approaches use a quadratic minimization process by the rounding error on the part of amounts distributed.

Round off

The floor function, also called Gaussian, integer or rounding function that maps each real number to the largest integer that is not greater than the real number.

  • The Gaussian function, the sign does not change, but may represent a positive number to zero.
  • For positive numbers in positional notation, the application of the Gaussian function is identical to the truncation of the fractional.
  • For each negative integer not the amount of the function value is greater than the magnitude of the input number.

Cents rounding

A special in Switzerland is the black horse rounding. Whilst it is anticipated Switzerland definitely needed with centimes, but no amounts are less than 5 cents paid in cash or charged. Effective amounts of money must be rounded accordingly. Where is rounded, this is done according to the following scheme:

The main reason for the rounding is the middle between 0 and 5 cents, respectively. between 5 and 10 cents the next. If the number to be rounded is equal to or higher than the center, it is rounded up, others rounded.

Should not be rounded, but generally rounded, this is done according to the following scheme:

For the calculation of commercial rounding of cents to be rounded amount needs to be 20 times expected. Subsequently, this result is rounded to 0 places. At the end of the rounded amount is again divided by 20.

This concept is also known in other countries, including in Finland, where the smallest unit of currency is the Euro 5 - cent coin.

Calculating with rounded numbers

Become a rounded figures included in a calculation, the end result in the same number of significant figures must be rounded. For example, if a force of 12.2 Newtons is measured, then all final results that depend on this force to be rounded so that no more than three significant digits remain. Thus the reader is not faking a higher accuracy than is really there.

Rounding in the computer

Since floating-point numbers occupy only a certain finite space in the computer, the accuracy is limited by nature. According to mathematical operations ( such as multiplication) also exist in the rule numbers that would require a higher accuracy. In order to display the result still needs to be rounded in some way so that the number in the appropriate number format ( eg, IEEE 754 ) fits.

The simplest rounding scheme is the truncation (English truncation or chopping ): A number on the left of a certain point left, the rest fall behind. Thus they will be rounded down to the next possible number. For example, if you rounded to zero decimal places, from a. This method is very fast, but it suffers from a relatively large rounding errors (in the example it is ). However, the performance is an indispensable tool in digital signal processing. As a single method can be prevented by rounding errors in digital filters with it an unstable limit cycle safely.

As a further rounding scheme, the commercial rounds is also used (English round -to -nearest ). You add this before rounding on the number to be rounded and cuts off after that. In the example, that would mean that is truncated to 3, the error in this case is only 0.25. However, this rounding is skewed positive.

Therefore, one takes into consideration the mathematical rounding (English round -to -nearest -even ) that rounds in both figures to the nearest even number. This rounding method is provided in the IEEE -754 standard. Alternatively, you can also rounded to the nearest odd number (English round -to -nearest -odd ).

Although the mathematical rounds shows good numerical performance, but it requires a full addition, since the carry passes through all digits of the number in the worst case. Thus, it has a relatively poor run-time performance. As possible to circumvent these problems, offers a ready-made table that contains the rounded results, which only need to be accessed.

25459
de