Weird Query Results

ahuvas

Registered User.
Local time
Today, 05:37
Joined
Sep 11, 2005
Messages
140
I have a simple query based on two fields that says

Component4 total = no of hours sleep/no of hours in bed * 100

where no of hours sleep = 9
no of hours in bed = 10

therefore component 4 total should = 90 instead it equals 89.999999

How can this be?

For all the other records the answer is correct down to the very last decimal place.


When I right click on the query for this component 4 total and change the format from general number to standard it will correctly respond to 90 but only because the numbers are being rounded up.

PS. THe numbers are definitely being stored and recalled as 9 and 10 and arent being rounded up because I inputed it as 9.0 and 10.0.
 
No idea. Create a db which exhibits this behaviour, then zip and post it.

Chris B
 
Computers work in binary, not decimal. Conversion between the two can sometimes throw up the odd fractional error. If this matters to you, then use the Round() function.
 
I wasnt able to recreate the issue and have since changed my database to use single -->standard --> 2 decimal numbers in the form. THis seems to have sorted the problem out. It just drove me crazy when I could clearly see that the equation was one of the most simple ever created and it still couldnt produce the right number.
 

Users who are viewing this thread

Back
Top Bottom