A first stab at budgeting

Christian Stimming stimming at tuhh.de
Wed Sep 17 14:17:22 CDT 2003


Wow, this looks really nice.

One of your open issues caught my eye:

Darin Willits schrieb:
> - I don't really use the commodities yet although each category has
> one.  Currently I just kinda fudge the calculations and use the value as
> a float.  This will have to change once I figure out just how all that
> commodity stuff actually works.

You are calculating with the amounts as *floats*? This is probably not a 
good idea, since amount handling as float/double was dropped from 
gnucash long ago because of rounding issues. The recommended way of 
calculating amounts is as a gnc_numeric type. Drawback: The usual 
arithmetic operations are no longer accessible as simply operators +-*/ 
but instead they have to be written as function calls 
gnc_numeric_add_fixed(a, b) from src/engine/gnc-numeric.h. Benefit: You 
won't encouter any silent rounding errors anymore. And the interface to 
the gnucash engine API can directly be used since gnc_numeric is used in 
the engine all over the place. (If there are functions that still accept 
doubles, they are probably clearly marked as deprecated and will be 
removed soon.)

I.e. using the gnc_numeric data type is far more important than any 
commodity considerations.

Thanks a lot in any case. Keep up the good work.

Christian



More information about the gnucash-devel mailing list