abs
The abs filter returns the absolute value.
1 2 3 4 5
{# number = -5 #} {{ number|abs }} {# outputs 5 #}
Note
Internally, Twig uses the PHP abs function.