Skip to content

Instantly share code, notes, and snippets.

@nombrekeff
Created February 27, 2018 16:13
Show Gist options
  • Save nombrekeff/c53c4c7ac0acc6657d58b8c0221940f0 to your computer and use it in GitHub Desktop.
Save nombrekeff/c53c4c7ac0acc6657d58b8c0221940f0 to your computer and use it in GitHub Desktop.
let scaled = "0.24372638";
let e = parseInt(scaled);
let d3 = padStart((parseInt((scaled * Math.pow(10, 3)).toString()) % Math.pow(10, 3)).toString(), 3);
let i5 = padStart((parseInt((scaled * Math.pow(10, 8)).toString()) % Math.pow(10, 5)).toString(), 5);
let scaled_ = {
significant: e + '.' + d3, // 0.243
insignificant: i5 // 72638
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment