Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nums = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'AA', 'BB', 'CC, 'DD', 'EE', 'FF', 'GG', 'HH', 'II'];
- function Beautify(num,floats)
- {
- if (!isFinite(num)) return 'Infinity'
- if(num < 1e3 || num >= parseFloat('1e' + 3*(nums.length))) return Math.round(num)
- var i = 0;
- 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.toFixed(3);
- return num + nums[i - 1]
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement