VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: j_vovus on February 22, 2012, 13:29:47 PM

Title: [BUG] Incorrect rounding with Tax Percents
Post by: j_vovus on February 22, 2012, 13:29:47 PM
Hi

I experience following problem with rounding (example with demo products installation):
In cart:
1. Name: Hand Shovel
    Qty: 2
    Price: 3.39 € (product_item_price)
    Discount: 2 €
    Tax: 9.25%

2. Name: Weight Shipping
    Price: 6 €
    Tax: 5%

Total: 9,70 €

But with simple formula:
Total = 2*(3.39*1.0925-2)+6*1.05 = 9.70715 ~ 9.71
we have 1 cent imprecision with mathematic rules rounding.

My payment provider verifies total mount with such calculations and if total amount != calculated amount it fails.

P.S.: With Qty=1 this example is ok, because rounding remainder (the third symbol after point) less then 5.
Title: Re: Incorrect rounding with Tax Percents
Post by: j_vovus on February 27, 2012, 10:47:21 AM
Any comments from VM developers?
Title: Re: [BUG] Incorrect rounding with Tax Percents
Post by: Matej.iStraxx on August 27, 2013, 12:34:47 PM
Rounding issue explanation by Milbo: Please read here http://forum.virtuemart.net/index.php?topic=108809.msg367089#msg367089