access query sum incorrect

estrela666

New member
Local time
Today, 15:40
Joined
Sep 14, 2010
Messages
4
Hello!
I'm trying to do a query in access with sum option but it's incorrect.
First, I list the values and it look like this:

duvida_access_1.jpg


Then, when I put sum in the 3 last fields, this is what happens:

duvida_access_2.jpg


According to picture 1, the sum should be 0. But is keeps appearing this strange value!!
The formula in the tot field is this: tot: [intValorIni_stk]+[intValorIniNeg_stk]

Anyone can help me, please?!

Thanks!!!
 
format it as fixed, 2 d places and see if it goes to zero

the problem is that doubles cant represent [some] real numbers exactly

so abs(51.45) may not be exactly the same as abs(-51.45), so that the sum adds to a very tiny number.

comparing a double to a specific value is always potentially problematic, because of this
 
It works! Thanks!
 

Users who are viewing this thread

Back
Top Bottom