Round method (number)

Rounds this number to a specified precision.

Syntax

number.Round(decimals)

Returns the number that is nearest to the number parameter with a precision equal to the decimals parameter.

If the number is halfway between two others, it is rounded toward the nearest number that is away from zero. If the precision of number is less than decimals, number is returned unchanged.

Example

{% Var number1 = 1.2345 %}
{% Var number2 = -2.5 %}

Answers: {{ number1.Round(0) }},
         {{ number1.Round(1) }},
         {{ number1.Round(3) }},
         {{ number1.Round(99) }},
         {{ number2.Round(0) }}

The above example would output: Answers: 1, 1.2, 1.235, 1.234, -3