Twig Format Number Filter not working
You're getting the error because of Twig's operator precedence. Filters take priority over math.
So basically Twig was trying change var2 to a percentage first instead of using the results of the math expression first, ie:
{{ var1 / (var2 | percentage) }}
Generally this behavior is usually what you want but sometimes there's edge cases where it doesn't work out. As you figured out, putting parenthesis around expressions to group them is never a bad idea especially when filters are involved.