RE: [xsl] Rounding errors in financial app transforms

Subject: RE: [xsl] Rounding errors in financial app transforms
From: "Abel Braaksma (online)" <abel.online@xxxxxxxxx>
Date: Fri, 27 Jul 2007 01:18:42 +0200 (CEST)
> 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.
>

Yes and no. No: bankers round to the nearest even digit. Yes:
100.105 becomes 100.10. And 100.115 becomes 100.12.

And that is exactly what round-half-to-even does (like stated in my
first post in this thread ;) See
http://www.w3.org/TR/xpath-functions/#func-round-half-to-even, and
consider this quote:

"This function is typically used in financial applications where the
argument is of type xs:decimal. For arguments of type xs:float and
xs:double the results may be counterintuitive. For example, consider
round-half-to-even(xs:float(150.0150), 2)."

Cheers,
-- Abel

Current Thread