util: more comprehensive num conversion, since its useful