Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access Summation Problem

Status
Not open for further replies.

bls123

Programmer
Nov 6, 2005
2
MY
I have a serious problem with summation using a query. I hope somebody can help me urgently.
>>
>> I have a list of numbers stored in a double precision field using Microsoft Access 2000. The list is as follow.
>> -5.36,-7.36,-0.8,-1.13,5.36,7.36,0.8,1.13
>>
>> When I execute the query : "SELECT sum(fieldname) as sAnswer FROM (tablename)", the answer suppose to be zero, but it turn out to be -1.77635683940025E-15.
>>
>> I try with single precision field , it is correct. Is there anyway I can sum up double precision field correctly?
 
This is the classic convertion of decimal fractions to binary problem.

What you need to do in ROUND the result to 3dp

"SELECT Round(sum(fieldname),3) as sAnswer FROM tablename "

and that will fix the problem.


'ope-that-'elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top