Decimal arithmetic, with example code

John Roth johnroth at ameritech.net
Thu Oct 3 08:13:43 EDT 2002


"James J. Besemer" <jb at cascade-sys.com> wrote in message
news:mailman.1033512243.4377.python-list at python.org...
>
> Tim Peters wrote:
>
> >No single rounding discipline is
> >suitable for all commercial applications,
> >
> Ain't it the Truth!!
>
> Businesses in the US are required to file quarterly reports about
periodic tax payments made during the quarter.  Taxes, e.g. on FICA and
Medicare, are computed as a percentage of each employee's wages and
deducted from the employee's paycheck each pay period.  On the quarterly
report, the actual liability is computed, based as a percentage of total
payroll for the period.
>
> These two computations (sum of percentages and percentage of sums) do
not always produce the same amount.  And yet the amounts on the return
have to match to the exact penny -- no rounding off to the nearest
dollar (like on personal returns).  Consequently, the form includes an
explicit entry for "round off error," to correct for minor differences
in computed liability vs. actual payments.

It gets even worse. Sometimes you've got to stagger which employees get
their pay, deductions and so forth rounded which way so that the total
payroll comes out close to the overall computation. And there's simply
no way to put that kind of logic into a basic arithmetic computation.

John Roth
>
> --jb
>
> --
> James J. Besemer 503-280-0838 voice
> 2727 NE Skidmore St. 503-280-0375 fax
> Portland, Oregon 97211-6557 mailto:jb at cascade-sys.com
> http://cascade-sys.com
>
>
>
>
>





More information about the Python-list mailing list