RE: [xsl] Rounding errors in financial app transforms

Subject: RE: [xsl] Rounding errors in financial app transforms
From: "W Charlton" <XSLList@xxxxxxxxxx>
Date: Thu, 26 Jul 2007 21:32:18 +0100
Justin,

It may be relevant to be aware that rounding in financial transactions is
not a simple mathematical problem, there is rounding and there is rounding.

Financial systems (at least all the ones we have dealt with) use have a
specific way or rounding money known as "bankers rounding" or "half even
rounding".

The problem value is the n.5. Most mathematics based system (and most
humans) including both versions of XSLT round to n+1. 

Bankers however round to n-1. That way I presume they get to make more
money!!

So if you try to round $100.105 to 2 decimal places you will get $100.11
whereas any financial system will (probably) expect $100.10.

If this IS the case you are going to have to force values at the tipping
point to go down not up.

Does that shed some light on your problem?


William Charlton
The yMonda team
yMonda Limited
w: www.ymonda.net

Current Thread