[GNC] Rounding & formulas
Peter West
lists at pbw.id.au
Mon Dec 21 08:01:41 EST 2020
Fred,
When I said no rounding as such I was referring to integer division. In integer division, 14/5 = 2, the same as 10/5, and all integers between. The rounding is simply throwing away the rubbish left over; the remainder.
Peter
--
Peter West
pbw at pbw.id.au
“Blessed are you among women, and blessed is the fruit of your womb!”
> On 21 Dec 2020, at 10:38 pm, Fred Bone <Fred.Bone at dial.pipex.com> wrote:
>
> On 21 December 2020 at 22:14, Peter West said:
>
>> There’s no rounding as such involved in the formulae. The timing will
>> only matter if total_amount changes between the two calculations, which I
>> assume it will not do. If x/2, when x is an integer (be it number of cents
>> or number of pennies or whatever), does not give identical results for the
>> same x whenever it is executed, something is seriously wrong.
>>
>> If x is a floating point number, odd things can happen. Even so, for the
>> same x, the result must be constant. The developers should be able to
>> clarify all of this.
>
> Of course there is rounding, but no-one suggested it was visible in the
> formulae.
>
> Half an odd number cannot be represented as a whole number and the end
> result is necessarily rounded either up or down. This is true even if the
> calculation is done in floating point rather than rational arithmetic.
>
> As I said, much depends on whether the rounding occurs at the end (as I
> would expect, and as the OP's report suggests) or at each stage of the
> calculation (which is inconsistent with the OP's report).
>
> _______________________________________________
> 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