C
cmpf
Was getting some interesting results coming out of some calculations in
access. To use a specific example, had the numbers 1.75 and 1.7.
Subtracting the two yielded .04999999999999. Displaying the Rounded numbers
later in a report then showed that 1.8 minus 1.7 = 0. Not ideal.
I fixed this by using a custom function based on the CDec vb function. Now
1.75 - 1.7 equals 0.05. Hurrah!
Unfortunately, 1.7-1.7 now seems to equal -0. Not 0. -0. Well, I should
clarify, it looks like 0 in the query, but when it is exported or accessed
elsewhere (i.e. excel) its passing through a -0. CDbl on the result yields
an Error. nz works, but changes blanks/nulls to zero as well, which I don't
want in this case. Any suggestions or insights?
access. To use a specific example, had the numbers 1.75 and 1.7.
Subtracting the two yielded .04999999999999. Displaying the Rounded numbers
later in a report then showed that 1.8 minus 1.7 = 0. Not ideal.
I fixed this by using a custom function based on the CDec vb function. Now
1.75 - 1.7 equals 0.05. Hurrah!
Unfortunately, 1.7-1.7 now seems to equal -0. Not 0. -0. Well, I should
clarify, it looks like 0 in the query, but when it is exported or accessed
elsewhere (i.e. excel) its passing through a -0. CDbl on the result yields
an Error. nz works, but changes blanks/nulls to zero as well, which I don't
want in this case. Any suggestions or insights?