Incorrect query calculations in access

T

Terry Fox

Here's my delima.....
I'm trying to do a couple of calculations in my query, in
which I need to do another query, and another calculation
on, and each calculation is incorrect.
My fields are set to "single, fixed and 2 decimal places"
in the table, which is exactly what is entered, and in
each query it's set to fixed and 2 decimal spaces, but
it's just not calculating correctly.
Example.....

in the table I have the following fields
Games = 52
MPR = 2.29

when I run a query, [games]*[mpr] it shows 119.08, which
is correct, but further down the line I found my
additional calculations were wrong, so I did a little
investigating, and when I actually have the calculated
field select, instead of showing 119.08, it shows
119.079998016357, which I believe is what's causing my
calculations down stream to be further messed up.
First of all, where the heck is Access getting this
calculation... it's not like it needed to round to get to
the 119.08... And 2nd, is there any way to work around
this...

Thanks
Terry
 
D

Douglas J. Steele

That's a fact of life using floating point numbers with computers. Just as
we can't exactly represent certain fractions like 1/3 or 5/6, there are many
numbers which a computer can only approximate.

There's an entire branch of Computer Science devoted to this issuse
(Numerical Methods)

You could try using the Currency data type: it's specifically designed to
minimize round-off error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top