Rounding
Operations and Regulations uses banker's rounding for all decimal rounding because it is the default rounding scheme for .NET, Java J2EE, other new coding languages, and other Infor products.
Banker's rounding (round half to even)
Banker's rounding handles numbers ending in exactly .5 differently than traditional rounding methods. Instead of consistently rounding up or down, banker's rounding rounds values ending in .5 to the nearest even integer or decimal place.
This method is also known by several other names, including unbiased rounding, convergent rounding, Gaussian rounding, statistician's rounding, and Dutch rounding.
Why use banker's rounding?
Banker's rounding is widely used in financial, statistical, and computational contexts because it minimizes cumulative bias in calculations involving large datasets. In traditional rounding, numbers ending in .5 are typically rounded up, which skews averages and sums toward slightly higher values. Banker's rounding avoids the bias by alternating between rounding up and down based on the parity (even or odd) of the nearest integers or decimal places. This ensures that rounding errors balance out, providing more accurate aggregate results.
How does it work?
When rounding a value:
- Identify the nearest integer or decimal place to the value to be rounded.
- If the value is exactly halfway between two numbers (such as 1.5), round to the nearest even value.
- For integers: 1.5 rounds to 2, while 2.5 also rounds to 2.
- For decimal places: If you rounding to two decimal places, 13.605 rounds to 13.60, while 13.615 rounds to 13.62.
Examples
Examples of rounding to an integer:
| Original | Rounded | Explanation |
|---|---|---|
| 1.4 | 1 | Below half, rounded down. |
| 1.5 | 2 | Exactly half, rounded to even integer. |
| 2.5 | 2 | Exactly half, rounded to even integer. |
| 4.6 | 5 | Above half, rounded up. |
| -2.5 | -2 | Exactly half, rounded to even integer. |
| -3.5 | -4 | Exactly half, rounded to even integer. |
Examples of rounding to two decimal places:
| Original | Rounded | Explanation |
|---|---|---|
| 13.605 | 13.60 | Exactly half, rounded to even decimal place. |
| 13.615 | 13.62 | Exactly half, rounded to even decimal place. |
| 13.605001 | 13.61 | Above half, rounded up. |
| 13.604999 | 13.60 | Below half, rounded down. |
Health check
These SQL scripts preview and fix billing transactions that aren't rounded to 2 decimals, i.e., to the nearest cent (0.01) value. These scripts also round transactions with near-zero amounts such as 0.0041 to 0.00.
Script for SQL Server:
-- Preview the affected transactions
SELECT * FROM BILLING.ACCTTRAN
WHERE TRANAMT <> ROUND(TRANAMT, 2);
-- Round all non-rounded transactions to .01
UPDATE BILLING.ACCTTRAN
SET TRANAMT = ROUND(TRANAMT,2), MODBY = 'INFOR – Round Tran Fix', MODDTTM = GETDATE()
WHERE TRANAMT <> ROUND(TRANAMT, 2);
Script for Oracle:
-- Preview the affected transactions
SELECT * FROM BILLING.ACCTTRAN
WHERE TRANAMT <> ROUND(TRANAMT, 2);
-- Fix the affected transactions
UPDATE BILLING.ACCTTRAN
SET TRANAMT = ROUND(TRANAMT,2), MODBY = 'INFOR – Round Tran Fix', MODDTTM = SYSDATE
WHERE TRANAMT <> ROUND(TRANAMT, 2);