chg: generalize number formatting function
and make it work with negative numbers
Merge pull request #165 from donat-b/stat_viewer

chg: generalize number formatting function