[GNC] Rounding & formulas

Greg Feneis mfeneis at gmail.com
Sun Dec 20 20:36:07 EST 2020


I don't know if the math functions are available, but various languages
have rounding functions.  If there's a rounding function, perhaps round up
and round down can be used?

  odd_cent_total/2 will have a fractional cent value in the answer, so
round up to the nearest cent for you and down to the  nearest cent for the
consort?




Kind regards,

Greg Feneis <http://www.linkedin.com/in/electromechanical>




On Sun, Dec 20, 2020 at 5:19 PM Adrien Monteleone <
adrien.monteleone at lusfiber.net> wrote:

> 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?
>
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> If you are using Nabble or Gmane, please see
> https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
>


More information about the gnucash-user mailing list