Shopify/liquid — pull request #368 by christianblais (2014-06-16 15:16:27+00:00)
Title: [Liquid] Add round, ceil and floor standard filters

**Problem**

Rounding numbers has always been kinda hard in Liquid, and people came up with solutions such as;

```javascript
$('.apply-round-to-this-div').html(function(index, oldhtml) {
return Math.round( parseFloat(oldhtml); );
});
```

or

```liquid
{% assign: perc = variant.compare_at_price | minus: variant.price | times: 100.0 | divided_by: variant.compare_at_price | plus: 0.5 %}
{% assign: perc = perc %}
{% capture perc %}{{ perc }}{% endcapture %}
{% assign: perc = perc | split: "." | first %}
```

Ref.: https://ecommerce.shopify.com/c/ecommerce-design/t/rounding-floats-using-liquid-filters-157565
Ref. : http://www.shopifyninjas.com/shopify-how-to-show-percentage-discount-saved/

**Solution**

This adds `round`, `ceil` and `floor` as standard filters in Liquid.

```liquid
"You save {{ 74.65 | round }}%!" #=> "You save 75%!"
```

**Note**

It seems odd to me that these filters were not already there. Is there any reason not to have them?

@fw42 @tobi