Having problem to monetary-collector

Bill Gribble grib@linuxdevel.com
26 Feb 2002 09:02:46 -0600


On Tue, 2002-02-26 at 08:22, Martijn van Oosterhout wrote:
> (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

It doesn't like the differing denominators.  The denominator of 0 in the
result signals an error, and the numerator is the error type.  Error
type -3 is GNC_ERROR_DENOM_DIFF, meaning that the addition operation was
specified to require arguments of the same denominator but the arguments
were different.  

I'm guessing that the collector API is strict about this because you are
supposed to be accumulating countable amounts of currency.  The number
with denominator of 10000 is not a countable amount of currency, but the
result of a multiplication of a price times a quantity.  You need to
convert it to the proper denominator for the local currency before
trying to add it. 

b.g.




> Unfortunatly, it appears the source of the numeric-collector is internal and
> thus not shipped with the compiled version. Any see what the problem is? And
> what to do about it?
> -- 
> Martijn van Oosterhout <kleptog@svana.org>
> http://svana.org/kleptog/
> > If the company that invents a cure for AIDS is expected to make their
> > money back in 17 years, why can't we ask the same of the company that
> > markets big-titted lip-syncing chicks and goddamn cartoon mice?
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel@lists.gnumatic.com
> http://www.gnumatic.com/cgi-bin/mailman/listinfo/gnucash-devel