Skip to main content

ROUND

Calculates a number rounded, will return the nearest round number to a significant set of decimal places.

This is a wrapper for the Math.Round function from Microsoft and has multiple options available. It looks like the Midpoint Rounding is set to rounding to nearest even (MidpointRounding.ToEven) rather than rounding away from zero (Midpoint.Rounding.AwayFromZero). You will find an example of how you can specify the rounding conversion within your function at the bottom of the page.

Syntax

double? ROUND(double? value, int digits)
decimal? ROUND(decimal? value, int decimals)

Example

ROUND(12.34567,2)

Returns '12.35'.

ROUND(1234.5678, 0)

Returns 1234.


To specify the rounding conversion to away from zero you can define the function as below:

Math.Round(DecimalNumber.Value,2, MidpointRounding.AwayFromZero)