[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ic] Rounding and discounts


I have run across a situation that highlights what I think is a problem
in the way discounts are applied.

E.g., if I have a 5% discount for an item that costs $49.50, and the
cart contains three items, then the total is

    ($49.50 * 3) * 0.95 = $141.075, which rounds to $141.07

That's because the IC code applies the discount to the cart by
multiplying the discount by the total cost for each item in the cart
(Vend::Interpolate::apply_discount).

However, this brings up an oddity: if I ask, "what is the discounted
price of each item?", the calculation of

    $141.07 / 3 = $47.025, which rounds to $47.02

In other words, you get a different answer if you apply the discount to
each item's per-item price, round, and then multiply by the quantity,
than if you calculate the undiscounted item subtotal, then discount,
then round.

Have others encountered this problem before? Should discounts and
rounding be applied in a different way to avoid this?

-- 
Jeffery Boes  <><
suppressed

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.