Decimal Math.Round(Decimal, Midpoint Rounding) 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#
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.
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
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
DecimalThe 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
Argument | mode is not a valid value of System.MidpointRounding. |
Overflow | The result is outside the range of a System.Decimal. |