Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
$5 difference due to rounding?
Message
 
 
To
14/11/2006 12:55:46
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01169448
Message ID:
01169564
Views:
15
>>Hi everybody,
>>
>>I have a field Commission paid in the table. For my report I also re-calculate commissions based on category. I use currency fields for commissions and I round the numbers by 2. Now the total commissions paid (which is near 10K) doesn't match the sum of totals commissions by category by $5.
>>
>>I'm wondering, should I try to not round my commissions in the calculations? The total commission paid field is Numeric (11,2).
>>
>>What do you think about this problem?
>>
>>Thanks in advance.
>>
>>UPDATE. Without the round the difference is only in the last digits (cents portion), so I lost $5 somehow in my calculations...
>
>I think you should look at all intermediate results. Probably you must round all intermediate results to 2 decimals as well, to get exactly the same results in both cases.

Hilmar,

It turned out that 1) I had some bugs in the logic now fixed
2) I didn't originally account for Memos and now I include them into the result.

With all these items sorted I now have a discrepancy less than 50 cents for the whole report, which I think is acceptable.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform