backport bigdecimal scaling and hexdump