ENG-4021 - decimal scaling issues

Fix decimal scaling issues. Also some easy performance tweaks to the decimal code.