Rounding in the price db.

Mike Alexander mta at umich.edu
Mon Aug 10 17:44:50 EDT 2015


--On August 10, 2015 at 4:27:40 PM +0100 John Ralls 
<jralls at ceridwen.us> wrote:

>> I seem to remember that banks here use 6 significant digits in
>> exchange  rates, which is not quite the same as 6 places after the
>> decimal point.  Your USD-Sao Tomean Dobra illustrates this: due to
>> the extreme value  difference between the two you need 10 digits
>> after the decimal point,  but only 6 of them are significant (ie not
>> a leading zero).
>>
>> Is this something our gnc_numeric code supports and can be used by
>> the  price db ?
>
> We have “significant digits” rounding code, but IIRC it’s
> really six decimal places. If we were to have real significant digits
> we’d need to be careful to keep it away from the debits-and-credits
> code or it could make a real mess.

Six significant digits would probably do, although I would argue for a 
few more to properly convert large quantities of a commodity.  However 
10 decimal places is easier to implement and is probably just as good. 
That seems to be what the XE conversion tables at 
<http://www.xe.com/currencytables/> use. Even that falls down 
converting gold to Sao Tomean Dobra, but it works ok for any real 
currency.  It gives 6 digits of accuracy converting between Kuwaiti 
Dinar and Sao Tomean Dobra which is the biggest ratio I can find.

              Mike
 



More information about the gnucash-devel mailing list