Language Constants - Rounding¶
The following constants can be used in the Round() function.
result Round(32.445, 2, drRoundHalfUp)
| Constant | Explanation |
|---|---|
| drRoundHalfToEven | Rounds to the nearest even number. As default "Gaussian" rounding will be used. This method uses the Gauss rule, also known as the "Banker's rounding", that if you are in a perfect half case, you must round to the nearest digit that can be divided by 2 (0, 2, 4, 6, and 8). This rule is important to obtain more accurate results with rounded numbers after multiple mathematical operations. |
| drRoundHalfUp | Rounds half towards positive infinity. That is, half-way numbers are always rounded up. If the fraction of num is exactly 0.5, then the result is num + 0.5. For example, by this rule the value 23.5 gets rounded to 24, but −23.5 gets rounded to −23. |