There is this thread where there is discussion of possible ways to address what may be a "penny" off/when talking about multiples of items there can be some rounding issues, though it seems a little odd for there to be a loss of some 50 cents: https://www.zen-cart.com/showthread.php?209786
In some respects it comes down to having multiple "methods" to obtain the values and pretty much so many so that the equations are overdetermined. You know whole degrees of freedom, unknown values, and equations to get the final result.
As far as how certain things can end up calculated? Well, sheesh, I just ran a "small" spreadsheet, though I'm getting myself confused with all of the possible variations of adding, rounding, truncating, and multiplying, I did find several cases where it was possible to have at least a penny off between two methods of calculation, also I found a case where it was possible to have 51 cents "removed" if say tax was calculated based off of the product's base cost and then the coupon applied against the tax the reduction in price/tax should have been 51 cents (based on one method of calculation).
In a similar thread to the above, I discuss "who" pays/gets the extra penny. I say that because at the bottom of any line there are things like the tax to be applied to a product and there is the tax to be applied to a purchase...
For example: Take the above sale but look at only the sales tax and disregard a discount.
the four decimal place taxes are:
$0.5120
$0.6360
$0.5120
$0.6368
$0.6360
$0.5120
which sum up to $3.4448 or in money speak: $3.44
But if you apply 8% to each product with the value truncated instead of rounded and then add those taxes (as if each tax is individually calculated but the remainder is just dropped):
$0.51
$0.63
$0.51
$0.63
$0.63
$0.51
Then the total is $3.42 for tax...
If each of those values is rounded instead of truncated:
$0.51
$0.64
$0.51
$0.64
$0.64
$0.51
Then the total tax is $3.45....
Which way is correct? At the end of the day when "filing" the paperwork, how is everything calculated/entered? Just fill in the blank: collected this much tax? Is it by total sale? number of sales made with each related amount calculated?
For most, it seems to come down to what is presented to the customer at the screen they are viewing and does it make sense to them... Like: hey I add the price of all these items together and then multiply by the tax rate and that's what the tax should be. Some say/would say that discounts do not alleviate the need to pay the tax associated with the original product (I have begun to think that this statement is just to cover situations like this where the "computer" doesn't figure it out right. :) )
I haven't gone through the a.net code to see how the calculations are pushed through to get to the final price, but there is likely something/more there.
ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...