Rounding approach
|
04-13-2014, 11:41 AM
(This post was last modified: 04-13-2014 11:45 AM by Dieter.)
Post: #4
|
|||
|
|||
RE: Rounding approach
(04-12-2014 07:29 PM)Tugdual Wrote: I was wondering if there was a theory (or at least libraries or algorithms) to handle that properly? The main problem is not the limited number of digits, it's the general rounding to two decimal places. Consider a very simple case like calculating the VAT amount when the gross price is given and the tax rate is 19%. This means that plus or minus cent gross price means 0,86 cent net price difference. Which inadvertedly leads to 1-cent-differences: Code: gross price: 103,00 EUR The exact VAT amount is 16,4454 EUR which mathematically rounds to 16,45. However, your local legislation may state that the result has to be rounded down to the next lower cent. In this case it works: Code: gross price: 103,00 EUR So if and how to round is not just a mathematical question. Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Rounding approach - Tugdual - 04-12-2014, 07:29 PM
RE: Rounding approach - Joe Horn - 04-13-2014, 06:44 AM
RE: Rounding approach - Paul Dale - 04-13-2014, 09:16 AM
RE: Rounding approach - Dieter - 04-13-2014 11:41 AM
|
User(s) browsing this thread: 1 Guest(s)