[GNC] gnucash_user: rounding errors and significant digits
Stan Brown (using GC 4.14)
stan+gc at fastmail.fm
Sat Sep 9 15:41:46 EDT 2023
On 2023-09-09 12:19, Ken Farley wrote:
> I really don't see what is so difficult to understand about this.
>
> The key equation is AMOUNT = PRICE * SHARES
>
> Gnucash works under the philosophy that two of those terms must be
> maintained precisely:
>
> AMOUNT - the total cost of the transaction. What you ultimately paid in
> the currency of your particular account.
>
> SHARES - how many units of the security were sold/bought.
>
> The PRICE, the amount paid per SHARE for this one transaction, is
> calculated using the other two. It's more an informative value than
> anything else.
>
> What I really care about when I get my statements from investment
> institutions, or trade notifications, is the number of SHARES involved
> and the total cost to me. It truly does not matter as far as maintaining
> a good set of books for my finances, what the exact to-the-20th-decimal
> PRICE was. I just want the SHARES and my current cash balance to be in
> agreement when compared to a financial institution's statement.
Well said, Ken! I was working on a message that would make those
points, but I'm glad I read yours before I posted mine.
I'll just add one point, for the people who are asking for a change to
GC in this area: you're asking the impossible. It is _mathematically_
not possible to have three decimal numbers A B and C, each rounded to a
desired number of decimal places, fulfill the equation A * B = C
exactly. For some particular numbers A and B, to some suitable number of
decimal places, it will indeed work out, but the general case is
mathematically impossible.
GnuCash has no choice but to consider one of the three quantities to be
only approximate, and I agree with you that share price is the right one
for that role. Number of shares and total amount must be exact to the
generally accepted numbers of decimal places, or people's books won't
balance.
Stan Brown
Tehachapi, CA, USA
https://BrownMath.com
More information about the gnucash-user
mailing list