Hi all,
At the moment I am working on a part of our system that requires a lot of calculations with different currency and percentages and i am feeling a little uncertain about the rounding that occurs.
In the database, currencies are represented as NUMBER with 6 digits after the decimal point, most other monetary values have two decimals. This translates to Decimal in the generated entities.
Has anyone encountered problems with rounding, especially in calculations like:
Decimal total = 0;
foreach(OrderEntity order in selectedOrders)
{
total += Quantity * Price / CurrencyRate;
}
What is the best strategy to avoid loss of digits in intermediate calculations.