Very weird numeric values

  • Thread starter Thread starter K90267000 via AccessMonster.com
  • Start date Start date
K

K90267000 via AccessMonster.com

One of my expression ("balance") in a query is:

Balance: NZ([a],0)+NZ()-NZ([c],0)-NZ([d],0)-NZ([e],0)-NZ([f],0)

The results :

Positive values : No problem
Negative values : No problem
Zero values : some No problem, some show values like "2.8421709430404E-14"

why is this so?

can someone help me with this please?

Thanks in advanced.
 
Because computers don't handle non-integer numbers precisely. A number with
the value 2.8421709430404E-14 essentially is zero, but because computers
slightly round numbers when storing them, zero minus zero minus zero minus
zero can add up to a very tiny difference, hence the value you see.

(I note that you're missing the second argument for the Nz function that is
wrapped around value.)

If you're dealing with currency values, for example, recast the numbers in
the expression using the CCur function; that should eliminate the problems:

Balance:
CCur(Nz([a],0))+CCur(Nz(,0))-CCur(Nz([c],0))-CCur(Nz([d],0))-CCur(Nz([e],0))-CCur(Nz([f],0))
 
Thanks! Thanks! Thanks! Thanks! Thanks!

Problem solved, i would NEVER figured that out myself as i am a self-taught
newbie..

This rocks!

Thanks Ken.
Because computers don't handle non-integer numbers precisely. A number with
the value 2.8421709430404E-14 essentially is zero, but because computers
slightly round numbers when storing them, zero minus zero minus zero minus
zero can add up to a very tiny difference, hence the value you see.

(I note that you're missing the second argument for the Nz function that is
wrapped around value.)

If you're dealing with currency values, for example, recast the numbers in
the expression using the CCur function; that should eliminate the problems:

Balance:
CCur(Nz([a],0))+CCur(Nz(,0))-CCur(Nz([c],0))-CCur(Nz([d],0))-CCur(Nz([e],0))-CCur(Nz([f],0))
One of my expression ("balance") in a query is:
[quoted text clipped - 11 lines]
Thanks in advanced.
 
You're welcome.

--

Ken Snell
<MS ACCESS MVP>


K90267000 via AccessMonster.com said:
Thanks! Thanks! Thanks! Thanks! Thanks!

Problem solved, i would NEVER figured that out myself as i am a
self-taught
newbie..

This rocks!

Thanks Ken.
Because computers don't handle non-integer numbers precisely. A number
with
the value 2.8421709430404E-14 essentially is zero, but because computers
slightly round numbers when storing them, zero minus zero minus zero minus
zero can add up to a very tiny difference, hence the value you see.

(I note that you're missing the second argument for the Nz function that
is
wrapped around value.)

If you're dealing with currency values, for example, recast the numbers in
the expression using the CCur function; that should eliminate the
problems:

Balance:
CCur(Nz([a],0))+CCur(Nz(,0))-CCur(Nz([c],0))-CCur(Nz([d],0))-CCur(Nz([e],0))-CCur(Nz([f],0))
One of my expression ("balance") in a query is:
[quoted text clipped - 11 lines]
Thanks in advanced.

 
Back
Top