Dear Ivan:
Actually, this is very revealing, as you have already seen. And the
solution is actually quite straight forward, though it seems mysterious at
the moment.
Your values seem to be of a datatype that is either "single" or "double".
These are forms used for scientific measurements. They should never be used
for accounting values.
Such values are not capable of exact representation of every decimal number.
They have great strength when used in science and engineering, but are
probably not acceptable for your purposes. Although I am an engineer by
training and have done a lot of such work, including computer programming,
I've never used any of these in a database. There are datatypes in
databases that ARE capable of representing your numbers exactly, and you
should stick with them. This includes the Currency or Money datatype, which
might be just what you would want here.
On the other hand, if you display the values you have on a form or report
with a specific number of decimal places, they should round to the values
you are expecting. 31.1599998474121 will display as 31.16 at 2 places,
31.160 at 3 places, and 31.1600 at 4 places. But when the values are added
in a long column, it might be possible that the tiny errors will accumulate,
and you'll get a sum that is not accountingly correct.
The moral is, don't use floating point (Single or Double) to represent
accounting values. Sorry if this creates a lot of work for you. In my
opinion, there isn't sufficient warning against this practice in the help
files and in some of the books on the subject I've seen.
Tom Ellison