Im working with an external payment system which uses a round down at exact midpoint, but round up if its anything more than that. I want to replicate the same in my application to match the value.
For example with two decimal point rounding, 150.415
is rounded to 150.41
and 150.4151
is rounded to 150.42
. I am not entirely sure what this rounding mechanism is called.
To replicate the same behaviour in C#, I tried using Math.Round(amount, 2, MidpointRounding.AwayFromZero)
and Math.Round(amount, 2, MidpointRounding.ToEven)
, but both rounds off the above number to 150.42
Trying to see what are my options here, including writing a custom function to do a similar rounding?