On Wed, Sep 9, 2015 at 10:59 PM, Scott Doctor <scott at scottdoctor.com> wrote:

>
> Best practice when dealing with floating point is to normalize and Chop.


In my line of business (ledger/ERP/retail) I don't think I can normalize
but chopping is definitely performed ?on each operation that can produce
rounding errors. Luckily the number of decimal digits is fixed (almost
always 3) and one can easily detect when there is a problem with rounding.
However, there are cases like the one I described above (distribution)
where deviations are inevitable, but it is usually acceptable to fix by
slightly violating the rules, e.g. calculating the rounding error and
adding it to a single row's amount in order to balance it out.

But I feel I have hijacked the thread so I think I'd better stop.

Reply via email to