var amount = 11368378000;
var unit = 10000;
var currency = '円';
var unitNames = ['万','億','兆','京','垓'];
var yen = humanReadableMoneyCount(amount, unit, currency, unitNames);
unit = 1000;
currency = ' dollers';
unitNames = [' thousand',' million',' billion',' trillion',' quadrillion',' quintillion'];
var dollers = humanReadableMoneyCount(amount, unit, currency, unitNames);
function humanReadableMoneyCount(amount, unit, currency) {
if (unit === void 0) unit = 10000;
if (currency === void 0) currency = "円";
if (unitNames === void 0) unitNames = ['万','億','兆','京'];
if (amount < unit) return amount + currency;
var exp = parseInt(Math.log(amount) / Math.log(unit));
var pre = unitNames[exp - 1];
return (amount / Math.pow(unit, exp)).toFixed(0) + pre + currency;
}
var count = 10968378;
humanReadableByteCount(count, true, '');
function humanReadableByteCount(bytes, si, b) {
if (b === void 0) b = "B";
var unit = si ? 1000 : 1024;
if (bytes < unit) return bytes + b;
var exp = parseInt(Math.log(bytes) / Math.log(unit));
var pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
return (bytes / Math.pow(unit, exp)).toFixed(1) + pre + b;
}