# Re: percentage discount not calculating properly

• Subject: Re: percentage discount not calculating properly
• From: Bob Miller <..hidden..>
• Date: Thu, 25 Feb 2010 10:13:00 -0800

```Hello All,

>
> As I read Bobs description of his problem, I understand it to be
> primarily that, an order of operations issue.
> Luke stated that the software is calculating as per
> round( round(price*discount) * quantity)
> while the expected order would be (preferably)
> round(quantity*price*discount) or at least
> round( round(quantity*price) * discount)
>
I have just spent the last several minutes searching google for a
best-practise regarding rounding and come up with nothing but a couple
of statements that no such thing exists.
The more I have been considering this, the more I see the existing
method of rounding the price of the individual item and multiplying it
by the quantity as making more sense.
As it is, given the example of 252 items at \$1.05 each with a 15%
discount we lose \$.0025 per item - which accounts for the discrepancy
noticed by my customer.  If we were to increase precision to 4 and
instead issue 252 separate invoices of one item at \$1.05 each with the
15% discount, our 252 separate invoices' sum total would equal a
different amount than our single invoice for 252 items.
It seems to me that I *should* arrive at the same total for these 252
items whether I invoice them separately or together, in which case the
current system of rounding would be "more correct".
This particular situation came to light because one of my client's
clients got a different number when they put it into their accounting
system, but I am starting to be curious if different accounting programs
would handle the matter differently, and perhaps three different
programs would give us three different dollar values on these invoices,
and I am also curious to know how different programs would deal with the
lumped invoice vs the individual invoice test I mentioned above...
I am not really sure I am asking a question here, so much as inviting
comment.  I am just perhaps wondering what is the "correct" way to be