Rounding error

Richard Kreiss rkreiss at verizon.net
Fri Mar 8 12:18:46 PST 2013


Had not thought about this problem until it bit me last night.  It is a
penny rounding error.

Take the situation of a $2000 annual payment.  If paid monthly the amount is
2000/12 or 166.6666667.  Put the value in a dummy field fv(6,.2)=166.67.

Here's the problem, calculate a 2 month amount:

Fv=(2000/12) or 166.67
qq(6,.2)=(2000/12)*2 = 333.33
fw(6,.2)=fv*2 = 333.34

A simple rounding error caused by the fact the value being divided inside
the parentheses which is not rounded in any way. The only way to avoid this
type of rounding error is simply to put the division values into a dummy
field and then use that field in your calculation.

I'm sure many of you and realize this but I thought I would just pass it on
just in case someone is having the same rounding error having difficulty
figuring out where it's coming from.


Richard Kreiss
GCC Consulting

Office: 410-653-2813






More information about the Filepro-list mailing list