# divided\_by

Divides a number by another number.

The result is rounded down to the nearest integer (that is, the [floor](https://shopify.github.io/liquid/filters/floor/)) if the divisor is an integer.

Input

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

Output

```
4
1
```

#### Controlling rounding <a href="#controlling-rounding" id="controlling-rounding"></a>

`divided_by` produces a result of the same type as the divisor — that is, if you divide by an integer, the result will be an integer. If you divide by a float (a number with a decimal in it), the result will be a float.

For example, here the divisor is an integer:

Input

```
{{ 20 | divided_by: 7 }}
```

Output

```
2
```

Here it is a float:

Input

```
{{ 20 | divided_by: 7.0 }}
```

Output

```
2.857142857142857
```

#### Changing variable types <a href="#changing-variable-types" id="changing-variable-types"></a>

You might want to use a variable as a divisor, in which case you can’t simply add `.0` to convert it to a float. In these cases, you can `assign` a version of your variable converted to a float using the `times` filter.

In this example, we’re dividing by a variable that contains an integer, so we get an integer:

Input

```
{% assign my_integer = 7 %}
{{ 20 | divided_by: my_integer }}
```

Output

```

2
```

Here, we [multiply](https://shopify.github.io/liquid/filters/times/) the variable by `1.0` to get a float, then divide by the float instead:

Input

```
{% assign my_integer = 7 %}
{% assign my_float = my_integer | times: 1.0 %}
{{ 20 | divided_by: my_float }}
```

Output

```


2.857142857142857
```
