xsl-list
[Top] [All Lists]

Re: [xsl] Rounding errors in financial app transforms

2007-07-26 07:38:56

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. 
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>