Math Filters

You can perform mathematical operations with math filters.


abs

Returns the absolute value of a number.

Input

 {{ -17 | abs }}

Output

 17

at_least

Limits a number to a minimum value.

Input

 {{ 1 | at_least: 2 }}

Output

 2

at_most

Limits a number to a maximum value.

Input

 {{ 1 | at_most: 2 }}

Output

 1

ceil

Rounds an input up to the nearest whole number. Liquid tries to convert the input to a number before the filter is applied.

Input

 {{ 1.2 | ceil }}
 {{ 2.0 | ceil }}
 {{ "183.357" | ceil }}

Output

 2
 2
 184

divided_by

Divides a number by another number. The result is rounded down to the nearest integer (that is, the floor) if the divisor is an integer.

Input

 {{ 16 | divided_by: 4 }}
 {{ 5 | divided_by: 3 }}

Output

 4
 1

floor

Rounds an input down to the nearest whole number. Liquid tries to convert the input to a number before the filter is applied.

Input

 {{ 1.2 | floor }}
 {{ 2.0 | floor }}
 {{ "183.357" | floor }}

Output

 1
 2
 183

max

Outputs the maximum value.

Input

 {{ 1 | max: 2 }}

Output

 2

min

Outputs the minimum value.

Input

 {{ 1 | min: 2 }}

Output

 1

minus

Subtracts a number from another number.

Input

 {{ 4 | minus: 2 }}

Output

 2

modulo

Returns the remainder of a division operation.

Input

 {{ 3 | modulo: 2 }}

Output

 1

plus

Adds a number to another number.

Input

 {{ 4 | plus: 2 }}

Output

 6

power

Calculates a power.

Input

 {{ 2 | max: 2 }}

Output

 4

round

Rounds a number to the nearest integer or, if a number is passed as an argument, to that number of decimal places.

Input

 {{ 1.2 | round }}

Output

 1

times

Multiplies a number by another number.

Input

 {{ 3 | times: 2 }}

Output

 6