|
-
April 25th, 2013, 08:53 AM
#7
Re: Calculation Problems
your problem is...
you are calculating values that end up having values that have more digits than 2.
you're only DISPLAYING 2 digits in the report
but the end result with full digits is correct.
You will need to explicitely round every intermediate value or accept the fact you are working with higher precision along the way and rounding at the very end. both methods are used in real life situations.
Follow your result with my changes...
696.60 - 27 Adult Meals at $25.80 each. ok
+ 46.44 - 3 Child Meals at $15.48 each. ok
--------
743.04 - Total Cost of All Meals (Add the above numbers together) ok
+ 52.01 - Weekend Surcharge (743.04 x .07) actually 52.0128 displayed as 52.01
+143.11 - Tax/Tip ((743.04 + 52.01) x .18) actually 143.109 displayed as 143.11
--------
938.16 - Total Party Cost actually 938.1618 displayed as 938.16
- 57.50 - Deposit Received ok
--------
880.66 - Balance Due actually 880.6618 displayed as 880.66
- 32.84 - 3.5% Prompt Payment Discount (938.16 x .035) actually 938.1618*.035 = 32.835663 displayed as 32.84 --------
847.83 - Balance Due (If Paid Within Ten Days) actually 847.826137 displayed as 847.83
the math is correct as y ou see above, you're just getting a different result than you expect because the sum of rounded values is not the same as a rounded sum of those same values
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|