# Math

> Liquid math filters for Shoplazza themes: abs, ceil, floor, round, plus, minus, times, divided_by and modulo, applied left to right when chained.

Math filters perform mathematical operations on numbers. You can apply math filters to numbers, variables, or metafields that return a number.

As with any other filters, you can use multiple math filters on a single input. They’re applied from left to right. In the example below, `minus` is applied first, then `times`, and finally `divided_by`.

**Code**

```liquid
You save {{ product.compare_at_price | minus: product.price | times: 100.0 | divided_by: product.compare_at_price }}%
```

## abs

`number | abs`

returns  [number](../basics/liquid-types#number)

Returns the absolute value of a number.

**Code**

```liquid
{{ -10 | abs }}
```

**Output**

```html
10
```

## ceil

`number | ceil`

returns  [number](../basics/liquid-types#number)

Rounds a number up to the nearest integer.

**Code**

```liquid
{{ 12.2 | ceil }}
```

**Output**

```html
13
```

## divided_by

`number | divided_by: number`

returns  [number](../basics/liquid-types#number)

Divides a number by a given number.

**Code**

```liquid
{{ 4 | divided_by: 2 }}

{{ 15 | divided_by: 4 }}

{{ 15 | divided_by: 4.0 }}
```

**Output**

```html
2

3.75

3.75
```

## floor

`number | floor`

returns  [number](../basics/liquid-types#number)

Rounds a number down to the nearest integer.

**Code**

```liquid
{{ 12.88 | floor }}
```

**Output**

```html
12
```

## minus

`number | minus: number`

returns  [number](../basics/liquid-types#number)

Subtracts a given number from another number.

**Code**

```liquid
{{ 12 | minus: 3 }}
```

**Output**

```html
9
```

## modulo

`number | modulo: number`

returns  [number](../basics/liquid-types#number)

Returns the remainder of dividing a number by a given number.

**Code**

```liquid
{{ 12 | modulo: 5 }}
```

**Output**

```html
2
```

## plus

`number | plus: number`

returns  [number](../basics/liquid-types#number)

Adds two numbers.

**Code**

```liquid
{{ 9 | plus: 3 }}
```

**Output**

```html
12
```

## round

`number | round`

returns  [number](../basics/liquid-types#number)

Rounds a number to the nearest integer.

**Code**

```liquid
{{ 3.9 | round }}

{{ 1.2 | round }}
```

**Output**

```html
4

1
```

### Round to a specific number of decimal places

`number | round: number`

returns  [number](../basics/liquid-types#number)

You can specify a number of decimal places to round to. If you don't specify a number, then the `round` filter rounds to the nearest integer.

**Code**

```liquid
{{ 3.14159 | round: 2 }}
```

**Output**

```html
3.14
```

## times

`number | times: number`

returns  [number](../basics/liquid-types#number)

Multiplies a number by a given number.

**Code**

```liquid
{{ 2 | times: 3 }}
```

**Output**

```html
6
```
