#### Round

##### Round(Number a, integer b)

This function is used to round to a specified scale determined by argument b for Double value a.

Parameters

- a - A Double value.
- b - A Scale value.

Return value

The return value is a Number.

Example

The return value of the following statement is 2.46.

`Round(2.4576, 2)`

##### Round(Number a)

This function returns the integer portion after a specified number has been rounded.

Parameter

a - A Double value.

Return value

The return value is an Integer.

Example

The return value of the following statement is 3.00.

`Round(2.754)`

##### Round(Number a, integer b, integer c)

This function is used to round to a specified scale determined by argument b and a specified rounding mode determined by argument c for Double value a.

Parameters

- a - A double value which will be rounded.
- b - The rounded scale.
- c - The rounding mode.

  c is used to represent the following different seven rounding modes, which can be specified as an integer between 0 and 6.

  - ROUND_UP = 0
    Rounding mode to round away from zero. Always increments the digit prior to a non-zero discarded fraction. Note that this rounding mode never decreases the magnitude of the calculated value.
  - ROUND_DOWN = 1
    Rounding mode to round towards zero. Never increments the digit prior to a discarded fraction (i.e., truncates). Note that this rounding mode never increases the magnitude of the calculated value.
  - ROUND_CEILING = 2
    Rounding mode to round towards positive infinity. If the value is positive, behaves as for ROUND_UP; if negative, behaves as for ROUND_DOWN. Note that this rounding mode never decreases the calculated value.
  - ROUND_FLOOR = 3
    Rounding mode to round towards negative infinity. If the BigDecimal is positive, behave as for ROUND_DOWN; if negative, behave as for ROUND_UP. Note that this rounding mode never increases the calculated value.
  - ROUND_HALF_UP = 4
    Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up. Behaves as for ROUND_UP if the discarded fraction is >= .5; otherwise, behaves as for ROUND_DOWN. Note that this is the rounding mode that most of us were taught in grade school.
  - ROUND_HALF_DOWN = 5
    Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down. Behaves as for ROUND_UP if the discarded fraction is > .5; otherwise, behaves as for ROUND_DOWN.
  - ROUND_HALF_EVEN = 6
    Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor. Behaves as for ROUND_HALF_UP if the digit to the left of the discarded fraction is odd; behaves as for ROUND_HALF_DOWN if it's even. Note that this is the rounding mode that minimizes cumulative error when applied repeatedly over a sequence of calculations

Return Value

The return value is a Number.

Example

The return value of the following statement is 2.03.

`Round(2.021, 2, 0)`

##### Round (Number a, Integer b, String c)

This function is use to round to a specified scale determined by argument b using the rounding mode c.

Parameters

- a - A double value which will be rounded.
- b - The rounded scale.
- c - The rounding mode. It can be Up (0), DOWN (1), CEILING (2), FLOOR (3), HALF_UP (4), HALF_DOWN (5), and HALF_EVEN (6). See the previous section about the detailed description of each rounding mode.

Return Value

The return value is a number.

Example

The return value of the following statement is 123.457.

`Round(123.4567, 3, 'UP')`

Note: The digits of the decimal fraction of the rounded number must be bigger than the scale specified in the formula.