0

I have two decimal values which are 865 and 720. I subtract the two, divide by 10, then round the result. Why is this coming to 14 instead of 15 when the value needing to be rounded is 14.5?

Here's the code:

public decimal CalculateExpoDollars(decimal previousYearActual, decimal goal, decimal currentYearActual)
{
    if (currentYearActual < goal && currentYearActual >= previousYearActual)
        return 0.00m;

    return Math.Round((currentYearActual - previousYearActual) / 10);
}
ganders
  • 7,285
  • 17
  • 66
  • 114
  • Please share the code in question so we can better assist you. – keeehlan Dec 10 '13 at 19:13
  • 1
    FYI - you can choose the type of rounding using the signature that takes a `MidpointRounding` enum - either as "ToEven" (the default) or "AwayFromZero" – tvanfosson Dec 10 '13 at 19:18

0 Answers0