Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var n = {
- log: Math.log(10),
- array: ["", "k", "M", "B", "T", "Qa", "Qi", "Sx", "Sp", "Oc", "No", "Dc", "UnD", "DuD", "TrD", "QaD", "QiD", "SeD", "SpD", "OcD", "NoD", "Vi", "UnV"],
- floor: function(a) {
- return (Math.abs(Math.abs(a) - Math.abs(Math.floor(a))) >= 0.999999991) ? ((a >= 0) ? Math.ceil(a) : Math.floor(a)) : ((a >= 0) ? Math.floor(a) : Math.ceil(a));
- },
- format: function(a, b) {
- var l = (n.floor(Math.log(Math.abs(a)) / n.log) <= 0) ? 0 : n.floor(Math.log(Math.abs(a)) / n.log),
- p = (l % 3 === 0) ? 2 : (((l - 1) % 3 === 0) ? 1 : 0),
- r = (Math.abs(a) < 1000) ? ((typeof b === "number") ? a.toFixed(b) : n.floor(a)) : (n.floor(a / (Math.pow(10, n.floor(l / 3) * 3 - p))) / Math.pow(10, p));
- return (typeof n.array[n.floor(l / 3)] === "string") ? (r + n.array[n.floor(l / 3)]) : "Infinite";
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment