Bad math in exchange rates (transfer dialog)

Daniel Hannum dhannum at magicdan.net
Sat Jul 12 08:23:27 CDT 2003


Somebody let me know if I should file a bug. Gnucash appear to be doing 
its math wrong when you transfer money from a normal asset account (USD) 
to a stock asset account (with some other commodity)

1. Make a new commodity
2. Make a new stock account that uses that commodity
3. Transfer money from any USD asset account to that stock account
4. Enter 6.50 as the amount
5. Set the accounts appropriate. The currency transfer part of the 
dialog will enable itself
6. Enter 0.644 as the 'to-amount'
7. Click back in the amount field and Gnucash will compute the price
8. Gnuash says that "1 foo = 10.092854 USD"
9. My calculator, however, says that the price should be 10.093168

That was a real world example. You might ask why I care about tenths of 
a cent. Here is a better contrived one that is obvious
Enter 1746.08 as the amount
Enter 56 as the 'to-amount'
The price should be *exactly* 31.18, but Gnucash says 31.181790

If hit Ok, and then try to make another transfer of 31.18 (1 share). 
Gnucash tries to help and puts "0.9999" in the to-amount box for me. So 
then I have to go in and fix it.

All of the stock accounts in question track commodities to 1/10000, 
which should be more than enough precision.

Thanks

dan



More information about the gnucash-devel mailing list