[GNC] Rounding & formulas

Adrien Monteleone adrien.monteleone at lusfiber.net
Sun Dec 20 20:15:04 EST 2020


Note, I'm not aware of a 'proper' solution that you are looking for.

Sounds like a lot of effort to avoid changing a single digit on review 
when occasionally the original amount is odd.

I would expect your try at "total_amount-(total_amount/2)" to only work 
half the time, thus a coin flip. Note, that's 29 characters. (not to 
count the clicks to get that far setting it up, or other characters 
involved) How many did you type asking this question? How much time and 
typing will you save, and if you find a solution, how long will it take 
to break even?

I'm not trying to be rude, but this is almost at the level of wanting to 
do accounting to the mille. The payoff will never be worth the effort.

Regards,
Adrien

On 12/19/20 12:09 PM, Thomas Lenherr wrote:
> 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?



More information about the gnucash-user mailing list