Proposal for modifying gnucash to use exact quantities
Thu, 27 Jul 2000 14:56:10 +0100
I've been thinking about storing gnc_numberic as a rational number and
had a look at some finance/law/accounting books and I thought that there
is one potential problem that may occur, please correct me if I'm wrong
or have misunderstood the proposal.
I don't want to make a theoretical point so I'll do my best to restrict
this to features either existing in Gnucash or conceivable to be added.
Say I buy 10 shares at 123_1/64 pence each. Gnucash will represent this
as 7873/64 pence per share so the total transaction value will be
78730/64 pence. My dealer will pay the seller of the shares 1231 pence,
and I will be billed for =A312.31 as sellers round up.
Gnucash will then remove 78730/64 pence from my share buying account and
correctly display this as -=A312.31.
Say I then repeat this transaction a further 6 times for some reason. I
will be billed =A312.31 * 6 =3D =A373.86 so I will be =A386.17 in overdra=
I enter this information into Gnucash and it removes 78730/64 * 6 from
my account so I am 551110/64 pence in debt. Gnucash will then display
this as -=A386.12 which is *not* the same as my bank balance.
The reason for the error is obvious, banks store balances as an integer
number of SCUs (BCD to be precise). You cannot trade in a anything less
than a SCU, banks will let you store anything less than a SCU and you
cannot get coins or notes in anything less than a SCU - it is therefore
reasonable to say that anything less than a SCU is not valid currency.
So storing an account balance to a precision of less than a SCU is at
best meaningless at at worst can lead to 'errors'.
The way I see it (which could perhaps be the wrong way) is that Gnucash
tracks the balance of various types of accounts in a similar way to what
banks do, and if banks store their data in BCD then we should really do
the same. To put it another way Gnucash tracks *money* which is a
As for exchange rates, yes they are ratios between one currency and
another and could be represented as rationals (in practice however they
are always shown as decimals for ease of use and computation), but this
is not important. What is important is when the deal goes though, you
either receive or pay an integer number of SCUs and this is what Gnucash
This is just my opinion, I do not propose myself to be an expert after
only a few days of reading so I'd be interested in peoples opinion on
PGP Keys: http://www.bigfoot.com/~murdomania/contact.htm
Geek Code: http://www.bigfoot.com/~murdomania/geek.htm