Control over sequence of math operations
Posted: Sat May 13, 2017 9:59 pm
Something that came up in viewtopic.php?f=20&t=8918 is that the totals didn't quite match those of another accounting product, because (apparently) adding, multiplication by tax rate (non-integer value), and rounding are not done in the same order between OC and the other product. Actually, this can be seen on a hypothetical page where you get cross totals: add up the columns of item extended prices, apply the tax rate to that subtotal, and get the rounded grand total. If you also apply taxes on each line item, round to display the subtotal (per line), and add up that column, you will likely get a slightly different result than in the first case! The same principle applies across software applications or if you have non-integer quantities (yards of cloth or metres of rope, for example).
You would get the same grand total if you carried through the unrounded values and added up those, but then the total of the rounded display values in a column (a customer checking your math) would not match the grand total.
There are two closely-related feature requests that spring from this. 1) control over the sequence of operations (add/subtract, apply a percentage, rounding) in OC to match what the other application is doing, so there is no discrepancy, and 2) when there are cross totals (as described in the first paragraph), specify which is to be used (or if unrounded values are to be summed) and if there is any difference in the values (this row, or the column total) offer a footnote or pop-up to explain it. This should keep customers from complaining that your store can't do basic math! Unfortunately, this might not be something that an extension can handle, but would have to be core feature.
You would get the same grand total if you carried through the unrounded values and added up those, but then the total of the rounded display values in a column (a customer checking your math) would not match the grand total.
There are two closely-related feature requests that spring from this. 1) control over the sequence of operations (add/subtract, apply a percentage, rounding) in OC to match what the other application is doing, so there is no discrepancy, and 2) when there are cross totals (as described in the first paragraph), specify which is to be used (or if unrounded values are to be summed) and if there is any difference in the values (this row, or the column total) offer a footnote or pop-up to explain it. This should keep customers from complaining that your store can't do basic math! Unfortunately, this might not be something that an extension can handle, but would have to be core feature.