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

Calculation has unusual result

Status
Not open for further replies.

Pigster14

Programmer
Jul 20, 2005
29
US
I am doing a calculation with three fields. Seems pretty simple, but I keep getting these weird results.

(PCLAMT_D + PCFAMT)-PRSAMT_D

Here are the numbers that fit with that....

(300650 + 0) - 300650 = (should be 0) But instead I get this 5.82076609134674E-11.

I had several that were .075628787878E-10 and I was finally able to say IIF((PCLAMT_D + PCFAMT)-PRSAMT_D) <0, 0[post0],[or do the actual equation].
That worked for most, except the above because it is not less than 0.

I have tried formatting using CDbl around them....I can not think of anything else to format them by.

I am continuing to play with this, but if anyone has an idea, it would be greatly appreciated.

Thanks for your help.
 

What are the field data types? I'm guessing that at least one of these fields is Single or Double which are not PRECISE.

Check out data types and PRECISION.

Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 


Geoff,

The order of operations should not matter in INTEGER ARITHMETIC.

However, what IS an issue with NON-INTEGER ARITHMETIC -- some sort of FLOATING POINT ARITHMETIC -- is RESIDUAL VALUES (to the right of the decimal point)

Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 
Play either with Long variables or with the Round function.

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

Part and Inventory Search

Sponsor

Back
Top