After discussion with some of the other developers, it is becoming
clear that most if not all of the problems people are having with
rounding and fractional cents are because, in fact, gnucash does not
know that there is a minimimum quantum of transactions for certain
types of accounts.  This is an attempt to lay out the problem and a
possible solution.  Please discuss.

Bill Gribble

======================

PROBLEM:  gnucash does not take into consideration the possibility
that a financial institution may not conduct transactions in fractional
currency units.

EXAMPLE: purchase 1 share of "foo" at 9 7/8 (9.875) from "bank".
"bank" balance is displayed as -9.88 (which is correct).  purchase 1
more share of "foo" at 9 7/8 from "bank", in another transaction.
"bank" balance is displayed as -19.75.  This is incorrect, since it
implies that the intermediate balance was -9.875 rather than (as 
was displayed) -9.88.

In fact, the displayed value "-9.88" is rounded from the actual
double-precision representation of the amount, -9.875.  The transfer
from the bank should have been, in each separate transaction, an
integer number of pennies (localized appropriately) meaning that the
bank balance should be -19.76.

This demonstrates the way in which gnucash currently represents all
quantities as double-precision floats and rounds these as appropriate
*for display only*.

PROPOSED SOLUTION: there must be account-type-specific (localized for
currency) rules describing the minimum unit of transaction for a
particular type of account and what to do with fractionally-unbalanced
amounts.  For example, it should be possible to restrict bank-account
transfers to integer pennies but allow for fractional-cent balances in
brokerage accounts if the brokerage handles the accounting in this
way. QUESTION: what types of accounts have what types of
transaction-quanta in the real world?

SIDE EFFECTS: In the case described in the EXAMPLE, 9.88 should be
transferred from the bank to purchase 1 share at 9.875.  The remaining
1/2 cent must be accounted for.

Accounting for the fractional amount: 

Alternative 1 is to add a split to the transaction which transfers the
remaining fractional amount into an account designated for such
things.  For security accounts, this could be a "commissions" account,
since the 1/2 cent is effectively a tiny commission on the
transaction.  This has the drawback of being confusing to naive users.

Alternative 2 is to fractionally adjust the price per share to reflect
the "true cost" of the shares purchased.  In the EXAMPLE,
price-per-share would be adjusted to 9.88, since the purchaser did
have to transfer 9.88 to purchase each share, though the market price
was 9.875.  This has the drawback of having possibly surprising
effects on the total value of holdings in an account.  example:
purchase 10,000 @ 9 7/8.  total holdings == $98750.  then purchase 1
more at 9 7/8, price rounded up to 9.88, total holdings == $98809.88,
an unexpected jump of $50.


--
Gnucash Developer's List
To unsubscribe send empty email to: [EMAIL PROTECTED]


Reply via email to