>Fabio,
>
>The trouble is that there are already precalculated values in a N(9,2) field. I was just trying to show the sorts of cumulative rounding errors that can result.
>
>I've seen it before- when using a UK copy of Quickbooks in Australia or New Zealand, sales tax is calculated wrongly because it is calculated on a line-by-line basis rounded to 2 decimal places, giving cumulative rounding errors, rather than as single calculation of the grand total.
This is where I had to learn to think like an accountant. And accountants don't care about cumulative rounding errors - every accountant knows where to stash them. They
do care about totals matching, and if there's a single cent mismatch, they'll sit on your neck until it matches.
The solution is what I wrote in the other message here - whatever monetary amount you need to calculate, store it in a separate field in the detail record. Don't apply any percentages to totals - total the calculated values, and don't care about rounding errors, they'll mostly cancel themselves out. If anybody tries to apply a percentage to your total, they'll get a result quite close to what your total of calculated amounts shows, and they usually won't do that. They will, however, become very loud if the totals don't match. So, precision be damned, do it the way they like it.