# Number Filters

Use number filters to convert, manipulate, and display numbers.

### abs

Returns the absolute value of a number.

abs

{{"-2" | abs}}
2

### at_least

Limits a number to a minimum value

at_least: number

{{-1 | at_least:5}}
5

### at_most

Limits a number to a maximum value

at_most: number

{{-1 | at_most:16}}
-1

### ceil

Returns the next integer value greater than or equal to the current value.

ceil: integer

{{3.2 | ceil}}
4

### divided_by

Divide the current value by operand.

divided_by: object operand

{{8 | divided_by:2}}
4

### floor

Returns the next integer value less than or equal to the current value.

floor: integer

{{5.9 | floor}}
5

### format

Returns the object formatted as a string using the provided format string. For numbers, the behavior is the same as the format_number filter below. The format filter may also be used with dates and time_diffs but they require different format strings.

### format_number

Returns the number formatted as a string using the provided standard or custom format string.

format_number: format

{{5.9 | format_number: "F4"}}    5.9000
{{5.9 | format_number: "F0"}}    6
{{5.9 | floor | format_number: "D"}}    5
{{-12445.6789 | format_number: "N"}}    -12,445.68
{{11 | format_number: "D8"}}    00000011
{{1234567890 | format_number: "(###) ###-####"}}    (123) 456-7890

### minus

Subtracts the operand from the current value.

minus: object operand

{{5 | minus:1}}
4

### modulo

Return the remainder of the current value when divided by the operand.

modulo: object operand

{{12 | modulo:5}}
2

### plus

Adds the operand to the current value. Note that this filter behaves differently if the current value is a string.

plus: object operand

{{3 | plus:5}}
8

### rand

Returns a random integer between 0 and the current integer.

rand

{{10 | rand}}
8

### round

Rounds a decimal value to the specified number of places.

round: integer places = 0

{{9.89| round}}
10

### times

Multiply the current value by the operand. Note that this filter behaves differently if the current value is a string and the operand is an integer.

times: object operand

{{2| times:7}}
14

### to_int

Converts the input into an integer. Useful when grabbing query parameters or other string inputs.

to_int

{{"2"| to_int}}
2

### to_number

Converts the input into a number, which could be an integer or a fractional number.

to_number

{{"2.2"| to_number}}
2.2