Hi.
Consider the following C# code:
Decimal number = new decimal(8.0549);
Decimal rounded = Math.Round(number, 2);
Console.WriteLine("rounded value: {0}", rounded);
will produce the output: 8.05
Math.Round's algoritm only checks the next digit beyond the decimals number taken as parameter.
I need a algoritm that checks all the decimals chain. In this case, 9 should rounds 4 to 5 which in turn will rounds 5 to 6, producing the final result 8.06
More exemples:
8.0545 -> 8.06
8.0544 -> 8.05
There's some built-in method that can help me?
Thanks.