For the concept of "rounding", I believe everyone is familiar with, because the primary three or four grade has been contacted, the conventional algorithm here withheld.
But for the banker algorithm, perhaps a lot of people are unfamiliar. Recent study encountered, but also understand the algorithm can be summed up as "four homes six into five to take the pair." That is: (assuming rounding of the decimal part),
The part to be rounded is exactly 0.5000, so you need to look at the parity of the previous one, the odd number, the even.
Give a few examples to describe, for example:
1.5000-2
2.5000-2
3.5000-4
4.5000-4
...... ......
So, why did you do that?
By regular rounding algorithm
...... ......
[0.5,1.5] = 1
[1.5,2.5] = 2
[2.5,3.5] = 3
[3.5,4.5] = 4
[4.5,5.5] = 5
[5.5,6.5] = 6
...... ......
Left closed right meeting let exactly for n+0.5 value all into, and left open right closed then all shed, so, general rounding will
The tendency to make a value to one end. Data too much, will form a relatively large deviation, so, someone proposed banker algorithm.
Banker algorithm
...... ......
(0.5,1.5) = 1
[1.5,2.5] = 2
(2.5,3.5) = 3
[3.5,4.5] = 4
(4.5,5.5) = 5
[5.5,6.5] = 6
...... ......
In this way, the values are separated by one n+0.5, so that the values tend to be balanced.
Overall, there is no big deviation in the data.
Rounding [banker algorithm]