VBspeed /
Articles /
Banker's rounding
|
VBspeed © 2000-10, updated: 30-May-2002 |
Banker's rounding |
Banker's rounding: the value is rounded to the nearest even number. Also known as "Gaussian rounding", and, in German, "mathematische Rundung".
|
Standard rounding: the value is rounded to the nearest number (be it odd or even). In German it is known as "kaufmännische Rundung".
|
VB6's native Round() function uses Banker's rounding, surprising to many since Standard rounding is more common ...
|
"Banker's rounding" is not bad
A remark by René Rhéaume, 21.09.01
... some people think "Banker's rounding" is bad,
but it is not the case. This "Banker's" method uses the Gauss
rule that if you are in an perfect half case, you must round to the
nereast digit that can be divided by 2 (0,2,4,6,8). This rule is
important to obtain more accurate results with rounded numbers after
operation.
Now, an example :
2 digits 2 digits
Unrounded "Standard" rounding "Gaussian" rounding
54.1754 54.18 54.18
343.2050 343.21 343.20
+106.2038 +106.20 +106.20
========= ======= =======
503.5842 503.59 503.58
Which one is nearer from unrounded result ? The "Gaussian" one
(Difference of 0.0042 with "Gaussian/Banker" and 0.0058
with "Standard" rounding.)
Another example with half-round cases only:
1 digit 1 digit
Unrounded "Standard" Rounding "Gaussian rounding"
27.25 27.3 27.2
27.45 27.5 27.4
+ 27.55 + 27.6 + 27.6
======= ====== ======
82.25 82.4 82.2
Again, the "Gaussian" rounding result is nearer from the unrounded
result than the "Standard" one.
René Rhéaume
rener@moncourrier.com
Jump to Round