Re: [xsl] Rounding errors in financial app transforms

Subject: Re: [xsl] Rounding errors in financial app transforms
From: Justin Johansson <procode@xxxxxxxxxx>
Date: Fri, 27 Jul 2007 00:25:12 +0900
David,

My apologies, I should have posed the question as,

"What exactly is the problem with division before I, AND OTHERS,
 go off thinking that all is home and hosed with xs:decimal?"

noting that there are many people who read the transactions of this list
without actively participating, such as people who are confused by
+ and - zero as demonstrated just a day or so ago.

Your answer provides insight to all, and best of all, in language
understood by everybody.

Thanks




At 03:38 PM 26/07/2007 +0100, you wrote:
>
>> 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. 
>________________________________________________________________________
>
>
>
Justin Johansson

*** A horse with no name is called Lambda ***

Current Thread