Subject: Re: [xsl] Rounding errors in financial app transforms From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 26 Jul 2007 15:38:35 +0100 |
> What's exactly is the problem with division multiplication you can always do, so long as you have enough precision to hold the answer. Unless you are dividing by 2 you can't ever do division exactly. 1 / 10 is 0.1 and that just can't be stored in binary arithemetic to any finite precision. So if you need to emulate BCD arithmetic _exactly_ you need to do arithematic using exponents being powers of 10 rather than 2, which means that you need to encode numbers as two integers, mantisa and (base 10) exponent. But since your financial calculation may well be going to finally round to only a couple of sp anyway, in all practical cases you probably get more than enough accuracy using xsd:decimal. David > (coming a company called from The Numerical Algorithms Group) ... Although actually before I started on this XML lark I was a pure mathematician not a nuerical analyst. Working in finite fields is so much easier (especially F_2 where you only have 0 and 1 to deal with:-) ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Rounding errors in financ, Michael Kay | Thread | Re: [xsl] Rounding errors in financ, Justin Johansson |
[xsl] how to assign a NULL to a var, shi wudao | Date | Re: [xsl] how to assign a NULL to a, David Carlisle |
Month |