Having problem to monetary-collector
26 Feb 2002 11:15:49 -0500
Christian Stimming <firstname.lastname@example.org> writes:
> > ;; debug output of the values going in
> > (gnc:debug (c 'getpair currency #f)) -> (#<gw:wcp <gnc:commodity*>
> > 0x81acb38> #<<gnc-numeric> num: -40950 denom: 100>)
> > (gnc:debug (gnc:split-get-amount s))
> > -> #<<gnc-numeric> num: 3709000 denom: 100000>
> > ;; Add them up
> > (c 'add currency (gnc:split-get-amount s))
> > ;; Display to output
> > (gnc:debug (c 'getpair currency #f))
> > -> (#<gw:wcp <gnc:commodity*> 0x81acb38> #<<gnc-numeric> num: -3 denom: 0>)
> > Huh?
> > -40950/100 + 3709000/100000 != -3/0
> > Two possibilities:
> > 1. It doesn't like the differing denominators
> > 2. It doesn't like the differing signs
> Oh, wasn't a zero denominator supposed to signal an gnc-numeric error
> anyway? Because a zero denominator doesn't make any sense in the first
Indeed, the 0 denominator implies "error". I think the problem is #1,
it doesn't like the differing denominators.
IMHO this is a bug (or at least a misfeature) in the gnc-numeric:
addition and subtraction have to be done in a common demoninator, as
opposed to having the system create the LCD. There are two sets of
'add' and 'subtract' functions -- the fixed versions assume that the
denominators are already the same, the other versions require you to
supply your result denominator. I suspect that the currency collector
is using the 'fixed' version and your test case is breaking that
assumption by supplying a different denominator.
FTR, I ran into this problem on the C side a few months ago.
Computer and Internet Security Consultant