1. 程式人生 > >js 值太大自動轉換bignumber

js 值太大自動轉換bignumber

 大值轉換

   function toNonExponential(num) {
        var m = num.toExponential().match(/\d(?:\.(\d*))?e([+-]\d+)/);
        return num.toFixed(Math.max(0, (m[1] || '').length - m[2]));
    }