Proposal for modifying gnucash to use exact quantities

Jason Rennie jrennie@ai.mit.edu
Sun, 30 Jul 2000 21:45:44 -0400


rkw@dataplex.net said:
> I might have one  account denominated in eights of a share of XYZ
> stock and another in  hundredths of a share of the same stock. In some
> respects, they are the  "same", but they really need different
> denominators.

A denominator of 1000 would take care of both just fine.

rkw@dataplex.net said:
> Another example might be an account denominated in "cents US" and
> another in  "dollars US". 

You'd want to consider those to be different currencies, wouldn't you?  
They're definitely not trivially interchangeable.

> jrennie@ai.mit.edu said:
> > No.  You do need the denominator.  Let's say that I'm converting 1 USD to
> > Italian Lira (for example).  The denominator for USD is 100.  The
> > denominator for Lira is 1.  The exchange rate is 1000 Lira for 1 USD.
> > The 1 USD will be internally represented as 100.  If I use your equation:

rkw@dataplex.net said:
> You are quoting the wrong exchange rate. You need the rate "100 cents
> US for  1000 Lira" because you are not dealing in "dollars US"

I think we have different interpretations of the rational representation
concept.  My interpretation is that if there is an account in USD, the
numerator-denominator pair together represent a quantity in USD.
Specifically, the USD quantity is "numerator/denominator".  By setting the
USD denominator to 100, I don't mean to introduce a notion of US cents.
For me, the numerator and denominator serve no purpose other than a
convenient internal representation.  Hence, any exchange rate that I would
use must be between the two currencies in question:

  (amount Lira) = (amount USD) * (rate)

My knowledge of the internal representation lets me directly solve for N2
(Lira numerator) since I know D2 (Lira denominator) to be fixed:

  N2 = (amount USD) * (rate) * D2

rkw@dataplex.net said:
> This is the problem if you don't carry units along with numbers when
> you  assign numbers to values input and output. 

Right.  Here, I'm making that knowledge explicit.  How would you know 
that you need the "100 cents US for 1000 Lira" rate without knowing that 
the USD denominator is 100?  What if my USD denominator were 1000?  
There's no reason that the denominator necessarily has to be the 
generally smallest unit of exchange.

rkw@dataplex.net said:
> No, the reason is that the rate was expressed in terms of cents and
> centavos  which are the units that we are using. On input and output,
> you must convert  to the internal units rather than the external units
> displayed. 

Didn't you need to know the respective currencies' denominators before 
you knew that the numerator values were in cents and centavos?

In one of the e-mails you wrote on this topic, I recall you stating that
knowledge of the denominator is not needed in order to perform a currency
exchange using the rational internal representation.  I don't see how that
is possible.

Jason D Rennie          www.ai.mit.edu/~jrennie/
MIT:  (617) 253-5339          jrennie@ai.mit.edu
MITRE: (781) 271-7249          jrennie@mitre.org