public static decimal Round (decimal d)
{
// Just call Decimal.Round(d, 0); when it rounds well.
decimal int_part = Decimal.Floor(d);
decimal dec_part = d - int_part;
if (((dec_part == 0.5M) &&
((2.0M * ((int_part / 2.0M) -
Decimal.Floor(int_part / 2.0M))) != 0.0M)) ||
(dec_part > 0.5M)) {
int_part++;
}
return int_part;
}
Math.Math::Round ( decimal d, MidpointRounding mode ) : decimal | |
Math.Math::Round ( decimal d, int decimals ) : decimal | |
Math.Math::Round ( decimal d, int decimals, MidpointRounding mode ) : decimal | |
Math.Math::Round ( double a ) : double | |
Math.Math::Round ( double value, MidpointRounding mode ) : double | |
Math.Math::Round ( double value, int digits ) : double | |
Math.Math::Round ( double value, int digits, MidpointRounding mode ) : double |