I am trying to calculate using RoundUp(). I am using the following code. Double per =(Double)Convert.ToDecimal((1.92* 100) / 2.2); Double p = RoundUp(per, 2); It is giving me a value of p =87.28 while value of per is 87.27272722727277 What is the reason for this? Surely it should be returning a value of 87.27 right? Please enlighten me. Thanks.
RoundUp
Math.Round()
Math.Round(per, 2)
Quote: Return Value Type: System.Double The integer nearest a. If the fractional component of a is halfway between two integers, one of which is even and the other odd, then the even number is returned. Note that this method returns a Double instead of an integral type.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)