In C #, when you do the division of two decimal places, the last digit of the result will be automatically rounded if the true mathematical result cannot be accurately stored as a decimal type.
I want to write a function that performs division, where the last digit is always rounded, even if the figure to the right of the last usually causes rounding.
My function will be declared as MyDivide (decimal a, decimal b)
As an example, MyDivide (2.0M, 3.0M) => 0.666666666666666666666666666666
whereas the C # division operator would give 2.0M / 3.0M => 0.666666666666666666666666666667
Any help in implementing this is appreciated.
decimal c # division
Andrew Best
source share