1
0
Fork 0
forked from 0x2620/oxjs

improve Ox.formatValue

This commit is contained in:
rlx 2012-03-24 10:39:21 +00:00
commit 7818d4deb6
2 changed files with 5 additions and 5 deletions

View file

@ -545,9 +545,9 @@ Ox.formatValue = function(num, str, bin) {
len = Ox.PREFIXES.length,
val;
Ox.forEach(Ox.PREFIXES, function(chr, i) {
if (num < Math.pow(base, i + 2) || i == len - 1) {
val = Ox.formatNumber(num / Math.pow(base, i + 1), i) +
' ' + chr + (bin ? 'i' : '') + str;
if (num < Math.pow(base, i + 1) || i == len - 1) {
val = Ox.formatNumber(num / Math.pow(base, i), i) +
' ' + chr + (chr && bin ? 'i' : '') + str;
return false;
}
});