Bad math in exchange rates (transfer dialog)

Derek Atkins warlord at MIT.EDU
Sat Jul 12 23:29:54 CDT 2003


Thanks.  There certainly were some rounding errors.  I was working on
this earlier today and fixed many of them, but there is one left which
is a bit harder to fix -- the "amount edit" widget (which is used
extensively) will internally truncate decimals.  This means that I can
set a value to, say, 10 decimals but it will truncate it to 6.

As I said, I've fixed most of the issues so far (although I'm still
testing the fixes).  Your particular test case, for example, has been
fixed (there was definitely a truncation issue).  I'll take more of a look
in a few days when I get some time again.

-derek

Daniel Hannum <dhannum at magicdan.net> writes:

> sorry. I noticed it in 1.8.1 and I specifically checked CVS to see if
> it was fixed (there was a changelog entry:
> 
> Fix the transfer dialog / exchange-rate dialog so it doesn't round
> the values input by the user. (#106332)
> 
> And then I forgot to tell you that it was in CVS. My bad. I'll put in
> a bug report.
> 
> Derek Atkins wrote:
> 
> >In all this you never state what version of GnuCash you are using.
> >However, I did test this with 1.8-CVS and the problem is still there.
> >Most likely the problem is that the rate calculations are limited to 6
> >decimal spaces, causing rounding to occur..
> >
> >So, yes, please file a bug report.
> >
> >-derek
> >
> >Daniel Hannum <dhannum at magicdan.net> writes:
> >
> >
> >>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
> >>
> >>_______________________________________________
> >>gnucash-devel mailing list
> >>gnucash-devel at lists.gnucash.org
> >>https://lists.gnucash.org/mailman/listinfo/gnucash-devel
> >>
> >
> >
> 

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list