xsl-list
[Top] [All Lists]

RE: [xsl] Rounding errors in financial app transforms

2007-07-26 16:19:01


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




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--