JRB-Bldr,
yes, that is a more general solution.
I would go another route.
1. seperate the rule on the result rounding and the calculation
2. Do the calculation with highest precision, meaning double values in vfp, which has about 15 decimal places
3. doing the rounding on favor of somebody - or whatever exactly the rule of the insurance company in mere mortal non math language is
This is not just a math thing, this is about fundamental program design rules, seperation of concerns, to be able to make changes independant on the calculation itself and the rounding rule.
In that aspect I'd do
Code:
amount = Cast(sometable.amount as double)
factor = Cast(someothertable.factor as double) && may also simply be .1 or cast(.1 as double)
preciseresult = calculation(amount, factor)
roundedresult = Floor(preciseresult*100)/100
Of course calculation could be a function, or a method call or you write the simple calculation itself, eg amount*factor.
Then if the rule changes to rounding the other way always, you can simply use Ceiling(), and if there is a change in calculation change that. This gives more control.
Bye, Olaf.