You are here:
round(value, precision, mode)
This function returns a value that’s rounded to the specified number of digits in the precision parameter.
Required Editions
| Available in Lightning Experience in Professional, Unlimited, and Enterprise Editions that have Consumer Goods Cloud enabled. |
Parameters
- value: Decimal value to round.
- precision: Number of digits to round to an integer.
- mode: Rounding mode or type (an enumeration)
let ROUNDING_TYPE = {"FINANCIAL": 1,"UP": 2,"DOWN": 3};
If the value of mode is 1, financial rounding is performed.
If the value of mode is 2, round up is performed.
If the value of mode is 3, round down is performed.
Returns
- value: Decimal value rounded to the specified number of digits.
Sample Usage
Utils.round(value, 1, 1)
Example Results of round(value, precision, mode)
| Value | Precision | Result Mode=1 | Result Mode=2 | Result Mode=3 |
|---|---|---|---|---|
| -1.91 | 0 | -2 | -1 | -2 |
| -1.91 | 1 | -1.9 | -1.9 | -2 |
| -1.91 | 2 | -1.91 | -1.91 | -1.91 |
| 1.91 | 0 | 2 | 2 | 1 |
| 1.91 | 1 | 1.9 | 2 | 1.9 |
| 1.91 | 2 | 1.91 | 1.91 | 1.91 |
| 7.86 | 0 | 8 | 8 | 7 |
| 7.86 | 1 | 7.9 | 7.9 | 7.8 |
| 7.86 | 2 | 7.86 | 7.86 | 7.86 |
| 4.99 | 0 | 5 | 5 | 4 |
| 4.99 | 1 | 5 | 5 | 4.9 |
| 4.99 | 2 | 4.99 | 4.99 | 4.99 |
| 12.344 | 0 | 12 | 13 | 12 |
| 12.344 | 1 | 12.3 | 12.4 | 12.3 |
| 12.344 | 2 | 12.34 | 12.35 | 12.34 |
| 16.367 | 0 | 16 | 17 | 16 |
| 16.367 | 1 | 16.4 | 16.4 | 16.3 |
| 16.367 | 2 | 16.37 | 16.37 | 16.36 |
Did this article solve your issue?
Let us know so we can improve!

