Round half to even algorithm
This article is designed to provide VCS user with information regarding the Rounding Rule applied in the system, which is round half to even (also known as Gaussian rounding or banker's rounding).
Despite the fact that there is a wide variety of rounding algorithms with a round half up (common method) being the most popular, Gaussian rounding is default for IEEE 754 (IEEE Standard for Floating-Point Arithmetic) computing functions and operators, and, therefore, has been impemented in VCS.
The idea behind it is that when a number is halfway between two others, it is rounded toward the nearest even number. For instance, 2.125 rounds down to 2.12; 2.135 rounds up to 2.14. Other decimal fractions are rounded according to a common method: 2.122 to 2.12, 2.127 to 2.13, -2.122 to -2.12 etc.
Two examples are given below to illustrate that round half to even algorithm givers better results and higher accuracy with operations involving rounding.
Example #1: Rounding to 2nd decimal digit
Unrounded | Common Rounding | Round to half even | |
---|---|---|---|
54.1754 | 54.18 | 54.18 | |
343.2050 | 343.21 | 343.20 | |
106.2038 | 106.20 | 106.20 | |
TOTAL | 503.5842 | 503.59 | 503.58 |
Difference | 0.0058 | 0.0042 |
Example #2: Rounding to 1st decimal digit
Unrounded | Common Rounding | Round to half even | |
---|---|---|---|
14.25 | 14.3 | 14.2 | |
36.45 | 36.5 | 36.4 | |
44.55 | 44.6 | 44.6 | |
TOTAL | 95.25 | 95.4 | 95.2 |
Difference | 0.15 | 0.05 |