Granted, but that only applies if total_amount is a floating point number. I didn’t think that one through.
$1.01/2 = 0.505 $1.01 - (1.01/2) = 1.01 - 0.505 = 0.505 Both results rounded = .50 I _never_ used floating point for monetary amounts, for reasons demonstrated above, and I pretty soon discovered that that was the general advice. The only currency that is not integral is Bitcoin. (That opens up a whole new can of worms.) Foreign currency transactions are different, but you would have currency conversion vestibules with integral amounts in and out. I assume from all of this that floating point is built in with the foundations, so it’s too late to do anything about it now. However, there is talk of moving to a database, in which case the representation of currency will, one hopes, be as a DECIMAL type, with the appropriate number of decimal places, and the OP's formulae will start to work, as if by magic. [As an aside, individual cents are now virtual in Australian currency, thanks to the ongoing debasement of same. Only in bank accounts and price books do cents exist. One and two cent pieces were withdrawn from circulation years ago. All cash payments are rounded to the nearest 5 cents.] Peter -- Peter West p...@pbw.id.au “My soul magnifies the Lord, and my spirit rejoices in God my Saviour…” > On 21 Dec 2020, at 2:01 pm, John Ralls <jra...@ceridwen.us> wrote: > > > >> On Dec 20, 2020, at 6:12 PM, Peter West <li...@pbw.id.au> wrote: >> >> I don’t understand why "total_amount-(total_amount/2)” doesn’t work. > > Maybe because the rounding happens after the whole computation? > > Regards, > John Ralls > _______________________________________________ gnucash-user mailing list gnucash-user@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.