Strange values when summing in a query

K

Kjell Harnesk

Why is it that a query in Access resturns strange values when summing simple
figures.
Example: I have a number of records with a number field values like 8 7.5
6 8 12 9.3 and so on.
When I make a query that sums these fields the correct sum may be 269.3 but
in the query is says 263.30000000013
or something like that.
 
D

Douglas J. Steele

It's floating point round-off error.

Just as humans can't represent certain fractions exactly in base 10 (think,
for example, 1/3, which is 0.333333 repeating), so too computers can't
represent certains fractions exactly in base 16. There's an entire branch of
computer science call numerical methods (or numerical analysis) devoted to
the study of how to reduce 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