

Rounding away from zero is the most widely known form of rounding, while rounding to nearest even is the standard in financial and statistical operations. These strategies are used in all cases, not just for midpoint values as MidpointRounding.ToEven and MidpointRounding.AwayFromZero are. NET Core 3.0 and later versions, three additional rounding strategies are available through the MidpointRounding enumeration. This form of rounding is represented by the MidpointRounding.ToEven enumeration member. Midpoint values are rounded to the nearest even number. Rounding to nearest even, or banker's rounding This form of rounding is represented by the MidpointRounding.AwayFromZero enumeration member. Midpoint values are rounded to the next number away from zero. The Round method supports two rounding conventions for handling midpoint values: In these cases, if the round-to-nearest strategy is used, the nearest value can't be easily identified without a rounding convention. For example, 3.47500 is a midpoint value if it is to be rounded to two decimal places, and 7.500 is a midpoint value if it is to be rounded to an integer. In a midpoint value, the value after the least significant digit in the result is precisely half way between two numbers. For example, you can use the Round(Double) method to round a value of 3.4 to 3.0, and the Round(Double, Int32) method to round a value of 3.579 to 3.58. Rounding involves converting a numeric value with a specified precision to a value with less precision.

Round a fractional value to an integer that is less than the fractional value. Round a fractional value to an integer that is greater than the fractional value. Round a number to a specified number of fractional digits while minimizing problems of precision in rounding midpoint values.Ĭall a rounding method that implements a "greater than or approximately equal to" comparison. Round a Single value to a specified number of fractional digits by using a specified rounding convention and minimizing the loss of precision.Ĭonvert the Single to a Decimal and call Round(Decimal, Int32, MidpointRounding). Round a number to a specified number of fractional digits by using a specified rounding convention. Round a number to a specified number of fractional digits by using the rounding to nearest convention. Round a number to an integer by using a specified rounding convention. Round a number to an integer by using the rounding-to-nearest convention. In addition to the Math.Round methods, it also includes Math.Ceiling and Math.Floor. You can use the following table to select an appropriate rounding method. Rounding and single-precision floating point values.

