decode num and hex + tests