Open fahimalizain opened 5 months ago
Use higher precision when doing the multiplication / division.
The following should give you the same grand total. But yeah, the package is missing the Bankers Rounding. However, tax is only rounded when filing the tax report. $1.91 is what you see on the tax invoice.
const total = currency(40, {precision: 4});
const subtotal = total.divide(1.05)
const tax = subtotal.multiply(0.05)
console.log(subtotal.value, ' -> ', currency(subtotal, { precision: 2 }).value)
console.log(tax.value, ' -> ', currency(tax, subtotal).value)
console.log(subtotal.add(tax).value)```
Please consider an Item that costs $40 with inclusive tax of 5%. When we break this into SubTotal, TaxAmount and GrandTotal, the following is what we get:
The expectation is that Bankers Rounding /
Round to Nearest, Ties to Even
will fix this issue?