You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue arises from rounding during the calculation of the exclusive price in the cleanExclusive function of the InclusiveAccuracyFix trait.
Example:
Product price: 15.00€ (Including 21% VAT)
Quantity: 12
The total is shown as: € 180.05, but it should be € 180.04.
Explanation:
The rounding happens when the exclusive price is calculated in the cleanExclusive function. Here's the problem:
The product price of € 15.00 (including 21% VAT) is divided by 1 + ($factor / 100) to get the price excluding VAT:
In the case of 21% VAT, the calculation is € 15.00 / 1.21 = € 12.3966942.
However, the result is rounded using RoundingMode::HALF_UP, which causes the price to be rounded to 12.40€ instead of 12.3966942€. The rounding cannot be disabled due to restrictions of brick/math.
The final calculation is:
€ 12.40 * 12 = € 148.80.
Adding the VAT: € 148.80 * 1.21 = € 180.04800, which rounds up to € 180.05 instead of € 180.00.
This rounding leads to an incorrect total price.
Steps to reproduce:
Add a product priced at € 15.00 (including 21% VAT) to the cart.
Set the quantity to 12.
Observe the total price being calculated as € 180.05 due to the rounding in the cleanExclusive function.
Expected behavior: The rounding should be avoided in the cleanExclusive function or handled differently so the exclusive price is not rounded prematurely. The total should be € 180.00 instead of € 180.05.
The product price of € 15.00 (including 21% VAT) is divided by 1 + ($factor / 100) to get the price excluding VAT: € 12.3966942. Price excluding VAT multiplied by product quantity 12 = € 148.76033 + VAT = € 179.999999 which will be rounded to € 180 .
The text was updated successfully, but these errors were encountered:
The issue arises from rounding during the calculation of the exclusive price in the cleanExclusive function of the InclusiveAccuracyFix trait.
Example:
Explanation:
The rounding happens when the exclusive price is calculated in the cleanExclusive function. Here's the problem:
The product price of € 15.00 (including 21% VAT) is divided by 1 + ($factor / 100) to get the price excluding VAT:
However, the result is rounded using RoundingMode::HALF_UP, which causes the price to be rounded to 12.40€ instead of 12.3966942€. The rounding cannot be disabled due to restrictions of brick/math.
The final calculation is:
This rounding leads to an incorrect total price.
Steps to reproduce:
Expected behavior: The rounding should be avoided in the cleanExclusive function or handled differently so the exclusive price is not rounded prematurely. The total should be € 180.00 instead of € 180.05.
The product price of € 15.00 (including 21% VAT) is divided by 1 + ($factor / 100) to get the price excluding VAT: € 12.3966942. Price excluding VAT multiplied by product quantity 12 = € 148.76033 + VAT = € 179.999999 which will be rounded to € 180 .
The text was updated successfully, but these errors were encountered: