fmt_dig function

Format digits before printing