[GNC] Rounding & formulas

Thomas Lenherr thomas at lenherr.name
Sat Dec 19 13:09:09 EST 2020


Hi,

I've been using gnucash for a few years now, including scheduled
transactions with variables/formulas, but one thing I never figured out is
how to avoid imbalances in them when variables cause "bad" rounding,
requiring me to fix those manually.

Simple example:
I use a scheduled transaction for an expense that varies month to month
(=variable), and I'd like to split it into two (share with another person,
i.e. book 50% against their account). Every now and then that amount is an
odd number of cents, and so just dividing by two for both the amount
against my expense account and their debitor-account results in an
imbalance that I need to fix manually (= I'm fine always being the person
that pays a cent more than the other one).

I tried to be "clever" by writing one of them as "total_amount/2" and the
other one as "total_amount-(total_amount/2)" but that didn't work either.
Is there a way to e.g. force rounding in the formula? E.g. something like
"round(total_amount/2, 0.01)" and "total_amount - round(total_amount/2,
0.01)"? Or is there a different solution I'm not aware of?

If there's no existing option, would it be hard to add support for such a
function or other solution?

Thank you for your help and thank you for this software!
 Thomas


More information about the gnucash-user mailing list