I have encountered weird behavior with the answer here having the most upvotes
{{ variable|number_format }}
I would still get "a non well formed numeric value encountered" error randomly, it went away only when I explicitly stated zero decimal digits
{{ variable|number_format(0, '', '') }}