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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation Error

Status
Not open for further replies.

BRANDON99

Technical User
Aug 29, 2003
52
FR
Hi

I have a table where data is entered in the first field, and then the remaining fields are updated useing queries. The problem is that e.g if the first number is say 4, and this is divided by 2, the result is show as 1.999999. The problem is that I am takeing the number before the decimal point to perform the next calculation, so the result is very wrong.

The table field is set to Single, fixed and 2 decimal places, but the problem persits.

How can I cure this

Many thanks

Brandon
 
Somewhere (in these Fora{e.g. Tek-Tips}) a wise user once answered their own question along hte lines of:

" ... problem solved, error between seat and keyboard ... "

Of course a better understanding of math in a digital setting would also contribute to some success.

Overall, you need to know/understand/grasp that digital representation cannot precisely represent all possible (real / floating point) values, so often you need to deal with the results is a pore pratical manner than your snippet indicates.







MichaelRed


 
Try to play with Currency or Decimal data type instead of floating point like Single or Double.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top