Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
$5 difference due to rounding?
Message
From
14/11/2006 10:54:53
 
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:
01169490
Views:
13
>>>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...
>>
>>Do rounding only at the end. Do any multiplication before division (each time you divide, unless pure even numbers, you can get a rounding error, compounded if several - so best just do once at end)
>>
>>You were short $5? Out of how much?
>>
>>Thought of taking up accountancy as a career? ..... Don't! :-)
>
>Out of 10K. E.g I have total commissions paid 9,819.20 and sum by categories gives me 9,824.07

Naomi, is this summing in a report or in a prog/method? Each commission field that you're adding up - is there a constraint on the number of dec. places, so rounding is implicitly happening there (See I don't know how many comm's you're adding). Hence, would making each comm. field with more dp help, then the result is rounded to 2 dp just at the end.
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform