Proposal for modifying gnucash to use exact quantities

Richard Wackerbarth rkw@dataplex.net
Tue, 1 Aug 2000 22:32:23 -0500


On Tue, 01 Aug 2000, Bill Gribble wrote:
> On Mon, Jul 31, 2000 at 08:05:04PM -0500, Richard Wackerbarth wrote:
> > 2) The "denominator" may need to be the reciprocal of an integer
> > greater than  unity.
>
> Good point.  How about, as was suggested, an idea that the denominator
> take on negative values (possibly hidden by a macro, i.e.
> GNC_DENOM_RECIPROCAL(1000) meaning that 1000 currency-units is the
> smallest transaction.

Just because it was proposed does not mean that it is an idea that should be 
embraced. From my perspective, such encoding "tricks" usually give rise to 
code that is inefficient and difficult to maintain.

> this would mean pushing the "special" denominator flags out of the
> denom argument, but I was irritated by that anyway.  They could just
> be replaced by one special denominator that indicates autocalculation
> of the denominator (which would probably be defined to be 0, which
> is never a valid denom) and having the LCD/reduction flags by or'ed in
> with the how argument:
>
>    gnc_numeric_add(a, b, GNC_DENOM_AUTO, GNC_DENOM_LEAST | GNC_RND_NEVER)

I still ask WHY? It is sufficient to have a simple gnc_numeric_add(a, b) and 
require the unification of the amounts to be added to be performed outside, 
rather than inside the addition routine.

Placing this unification code inside the addition code is a computational 
burden on EVERY addition, even the vast majority (if not all) of the 
additions which are performed on ammounts from the same account that are 
already in the same representation and need no coersion.