Re: IEEE-754 DP-FP rounding question



On Feb 15, 11:45 pm, glen herrmannsfeldt <g...@xxxxxxxxxxxxxxxx>
wrote:
Taxes are funny that way. I do remember the Maryland sales tax
from some years ago, which tended to round up much more often than
you might expect.

I remember some years ago after a winery tour, in line to buy some
wine. I had figure out from watching those in front of me that it
cost one cent less to buy two bottles separately, than to buy them
together. I presume, then, that sometimes your rounding will give
different tax amounts to two items that have the same price.


Correct. Consider an invoice with three lines items, each for 33
cents. Then assume 10% tax. So the tax on the invoice is going to be
10 cents. If you try to expand that on each line item you either get
three cents on each line item (and you're obviously missing a penny
someplace), or two of the 33 cent line items get three cents of tax
and the other 33 cent line item gets four cents.

The obvious answer is "don't do that," but it's certainly not
unreasonable that a customer would want to know how much tax he paid
on the widgets in line item #3.

.