Method
round — Rounds a value to a specified precision
that is the number of digits after the decimal point. precision
can also be negative or zero
Description
Minimum number of arguments for this method is three.
Structure of the method:
round(value, precision, mode)
Parameters
value — The value to be rounded
precision — number of digits after the decimal point
mode — mode parameter is specified by constants that define how to perform the round.
Values of mode
ROUND_HALF_UP — Rounds the value up to precision away from zero.
ROUND_HALF_DOWN — Round value down to precision towards zero.
ROUND_HALF_EVEN — Round value to precision decimal places towards the nearest even value.
ROUND_HALF_ODD — Round value to precision decimal places towards the nearest odd value.
Examples
{{round(9.5, 0, 'ROUND_HALF_UP')}}
//Output: 10
{{round(9.5, 0, 'ROUND_HALF_DOWN')}}
//Output: 9
{{round(9.5, 0, 'ROUND_HALF_EVEN')}}
//Output: 10
{{round(9.5, 0, 'ROUND_HALF_ODD')}}
//Output: 9
To stay updated with the latest features, news and how-to articles and videos, please join our group on Facebook, Flexie CRM Academy.