现在被广泛使用的数字修约规则主要有四舍五入规则四舍六入五留双规则

 

[编辑] 四舍五入规则

四舍五入规则是人们习惯采用的一种数字修约规则。

四舍五入规则的具体使用方法是:

在需要保留有效数字的位次后一位,逢五就进,逢四就舍。

例如:将数字2.1875精确保留到千分位小数点后第三位),因小数点后第四位数字为5,按照此规则应向前一位进一,所以结果为2.188。同理,将下列数字全部修约为四位有效数字,结果为:

0.53664——0.5366
10.2750——10.28
18.06501——18.07
0.58346——0.5835
16.4050——16.41
27.1850——27.19

按照四舍五入规则进行数字修约时,应一次修约到指定的位数,不可以进行数次修约,否则将有可能得到错误的结果。例如将数字15.4565修约为两位有效数字时,应一步到位:15.4565——15(正确)。如果分步修约将得到错误的结果:15.4565——15.457——15.46——15.5——16(错误)。

四舍五入修约规则,逢五就进,必然会造成结果的系统偏高,误差偏大,为了避免这样的状况出现,尽量减小因修约而产生的误差,在某些时候需要使用四舍六入五留双的修约规则。

 

[编辑] 四舍六入五留双规则

为了避免四舍五入规则造成的结果偏高,误差偏大的现象出现,一般采用四舍六入五留双规则(Banker's Rounding)。 四舍六入五留双应该改为: 四舍六入逢五无后则留双,这样描述更容易理解和记住.


四舍六入五留双规则的具体方法是:

(一)当尾数小于或等于4时,直接将尾数舍去。

例如将下列数字全部修约为四位有效数字,结果为:

0.53664——0.5366
10.2731——10.27
18.5049——18.50
0.58344——0.5834
16.4005——16.40
27.1829——27.18

(二)当尾数大于或等于6时,将尾数舍去并向前一位进位。

例如将下列数字全部修约为四位有效数字,结果为:

0.53666——0.5367
8.3176——8.318
16.7777——16.78
0.58387——0.5839
10.29501——10.30
21.0191——21.02

(三)当尾数为5,而尾数后面的数字均为0时,应看尾数“5”的前一位:若前一位数字此时为奇数,就应向前进一位;若前一位数字此时为偶数,则应将尾数舍去。数字“0”在此时应被视为偶数。


例如将下列数字全部修约为四位有效数字,结果为:

0.153050——0.1530
12.6450——12.64
18.2750——18.28
0.153750——0.1538
12.7350——12.74
21.845000——21.84

(四)当尾数为5,而尾数“5”的后面还有任何不是0的数字时,无论前一位在此时为奇数还是偶数,也无论“5”后面不为0的数字在哪一位上,都应向前进一位。

例如将下列数字全部修约为四位有效数字,结果为:

0.326552——0.3266
12.73507——12.74
21.84502——21.85
12.64501——12.65
18.27509——18.28
38.305000001——38.31

按照四舍六入五留双规则进行数字修约时,也应像四舍五入规则那样,一次性修约到指定的位数,不可以进行数次修约,否则得到的结果也有可能是错误的。例如将数字10.2749945001修约为四位有效数字时,应一步到位:10.2749945001——10.27(正确)。如果按照四舍六入五留双规则分步修约将得到错误结果:10.2749945001——10.274995——10.275——10.28(错误)。

======================================================================================

Common method

This method is commonly used in mathematical applications, for example in accounting. It is the one generally taught in elementary mathematics classes.[citation needed] This method is also known as Asymmetric Arithmetic Rounding or Round-Half-Up (Asymmetric Implementation)

1. Divide it by the unit to which it is to be rounded

2. Round it to the nearest whole number, unless it ends in exactly .5

3. If it ends in exactly .5, then add 0.5

4. Multiply it by the unit to which it is to be rounded

Examples (rounded to hundredths):

  • 3.0448 → 304.48 → 304 → 3.04
  • 3.0450 → 304.50 → 305 → 3.05
  • 3.0452 → 304.52 → 305 → 3.05
  • -3.0448 → -304.48 → -304 → -3.04
  • -3.0450 → -304.50 → -304 → -3.04
  • -3.0452 → -304.52 → -305 → -3.05

As the name implies, this can introduce a bias: if all the unrounded numbers had four decimal places, say, then in our example the expected average of the rounded numbers will be 0.0005 higher than that of the unrounded numbers.

[edit] Round-to-even method

This method, also known as unbiased rounding, convergent rounding, statistician's rounding, Dutch rounding, Gaussian rounding, or bankers' rounding, exactly replicates the common method of rounding except when the digit(s) following the rounding digit starts with a five and has no non-zero digits after it.

Despite the custom of rounding the number 4.5 up to 5, in fact 4.5 is no nearer to 5 than it is to 4 (it is 0.5 away from both). When dealing with large sets of scientific or statistical data, where trends are important, traditional rounding on average biases the data upwards slightly. Over a large set of data, or when many subsequent rounding operations are performed as in digital signal processing, the round-to-even rule tends to reduce the total rounding error, with (on average) an equal portion of numbers rounding up as rounding down. This generally reduces upwards skewing of the result.

The new algorithm becomes (only rule 3. changes):

1. Divide it by the unit to which it is to be rounded

2. Round it to the nearest whole number, unless it ends in exactly .5

3. If it ends in exactly .5, then round towards the nearest even whole number

4. Multiply it by the unit to which it is to be rounded

Examples (rounded to hundredths):

  • 3.0448 → 304.48 → 304 → 3.04
  • 3.0450 → 304.50 → 304 → 3.04
  • 3.0452 → 304.52 → 305 → 3.05
  • -3.0448 → -304.48 → -304 → -3.04
  • -3.0450 → -304.50 → -304 → -3.04
  • -3.0452 → -304.52 → -305 → -3.05

Thus the bias mentioned above has been removed. Provided the distribution of the unrounded numbers is uniform, the expected average of the rounded numbers will be the same as that of the unrounded numbers.

[edit] History

The Round-to-even method has served as the ASTM (E-29) standard since 1940. The origin of the terms unbiased rounding and statistician's rounding are fairly self-explanatory. In the 1906 4th edition of Probability and Theory of Errors [1] Robert Simpson Woodward called this "the computer's rule" indicating that it was then in common use by human computers who calculated mathematical tables. Churchill Eisenhart's 1947 paper "Effects of Rounding or Grouping Data" (in Selected Techniques of Statistical Analysis, McGrawHill, 1947, Eisenhart, Hastay, and Wallis, editors) indicated that the practice was already "well established" in data analysis.

The origin of the term bankers' rounding remains more obscure. If this rounding method was ever a standard in banking, the evidence has proved extremely difficult to find. To the contrary, section 2 of the European Commission report The Introduction of the Euro and the Rounding of Currency Amounts [2] suggests that there had previously been no standard approach to rounding in banking, and specifies that "half-way" amounts should be rounded up.

 

posted on 2009-06-05 16:28  SamZhang  阅读(9563)  评论(0编辑  收藏  举报