DecimalMath.Round(Decimal, MidpointRounding) Method

Rounds a decimal value to the nearest integer. A parameter specifies how to round the value if it is midway between two other numbers.

Definition

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public static decimal Round(
	decimal value,
	MidpointRounding mode
)

Parameters

value  Decimal
A decimal number to be rounded.
mode  MidpointRounding
Specification for how to round value if it is midway between two other numbers.

Return Value

Decimal
The integer nearest value. If value is halfway between two numbers, one of which is even and the other odd, then mode determines which of the two is returned.

Exceptions

ArgumentException mode is not a valid value of System.MidpointRounding.
OverflowException The result is outside the range of a System.Decimal.

See Also