Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tempNums1 = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y', 'X', 'V', 'U', 'S', 'H', 'F', 'L', "W"];
- tempNums2 = ['', 'N', 'NN', 'NNN', 'NNNN', 'Q', 'NQ', 'NNQ', 'NNNQ', 'NNNNQ', 'QQ', 'NQQ', 'NNQQ', 'NNNQQ', 'NNNNQQ', 'QQQ', 'NQQQ', 'NNQQQ', 'NNNQQQ', 'NNNNQQQ', 'QQQQ',];
- nums = [];
- for (var i = 0; i < tempNums2.length; i++){
- for (var j = 0; j < tempNums1.length; j++){
- nums.push(tempNums1[j] + tempNums2[i]);
- };
- };
- function Beautify(num,floats)
- {
- if (!isFinite(num)) return 'Infinity'
- var i = 1;
- while(num >= 1000)
- {
- num/=1000;
- i++;
- }
- num = Math.round(num*1000)/1000;
- if(num>=1000)
- {
- num/=1000;
- i++;
- num = Math.round(num*1000)/1000;
- } //deals with rounding errors
- num = num.toString();
- if(num.indexOf('.') == -1) num += '.000'
- else
- {
- dec = num.indexOf('.');
- while(num.slice(dec,num.length).length < 4) num += '0' //adds trailing 0s (if needed) to stop the numbers jumping around.
- }
- return num + nums[i - 1]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement