/* big.js v3.1.3 https://github.com/MikeMcl/big.js/LICENCE */1;(function (global) {2'use strict';34/*5big.js v3.1.36A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.7https://github.com/MikeMcl/big.js/8Copyright (c) 2014 Michael Mclaughlin <[email protected]>9MIT Expat Licence10*/1112/***************************** EDITABLE DEFAULTS ******************************/1314// The default values below must be integers within the stated ranges.1516/*17* The maximum number of decimal places of the results of operations18* involving division: div and sqrt, and pow with negative exponents.19*/20var DP = 20, // 0 to MAX_DP2122/*23* The rounding mode used when rounding to the above decimal places.24*25* 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)26* 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)27* 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)28* 3 Away from zero. (ROUND_UP)29*/30RM = 1, // 0, 1, 2 or 33132// The maximum value of DP and Big.DP.33MAX_DP = 1E6, // 0 to 10000003435// The maximum magnitude of the exponent argument to the pow method.36MAX_POWER = 1E6, // 1 to 10000003738/*39* The exponent value at and beneath which toString returns exponential40* notation.41* JavaScript's Number type: -742* -1000000 is the minimum recommended exponent value of a Big.43*/44E_NEG = -7, // 0 to -10000004546/*47* The exponent value at and above which toString returns exponential48* notation.49* JavaScript's Number type: 2150* 1000000 is the maximum recommended exponent value of a Big.51* (This limit is not enforced or checked.)52*/53E_POS = 21, // 0 to 10000005455/******************************************************************************/5657// The shared prototype object.58P = {},59isValid = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,60Big;616263/*64* Create and return a Big constructor.65*66*/67function bigFactory() {6869/*70* The Big constructor and exported function.71* Create and return a new instance of a Big number object.72*73* n {number|string|Big} A numeric value.74*/75function Big(n) {76var x = this;7778// Enable constructor usage without new.79if (!(x instanceof Big)) {80return n === void 0 ? bigFactory() : new Big(n);81}8283// Duplicate.84if (n instanceof Big) {85x.s = n.s;86x.e = n.e;87x.c = n.c.slice();88} else {89parse(x, n);90}9192/*93* Retain a reference to this Big constructor, and shadow94* Big.prototype.constructor which points to Object.95*/96x.constructor = Big;97}9899Big.prototype = P;100Big.DP = DP;101Big.RM = RM;102Big.E_NEG = E_NEG;103Big.E_POS = E_POS;104105return Big;106}107108109// Private functions110111112/*113* Return a string representing the value of Big x in normal or exponential114* notation to dp fixed decimal places or significant digits.115*116* x {Big} The Big to format.117* dp {number} Integer, 0 to MAX_DP inclusive.118* toE {number} 1 (toExponential), 2 (toPrecision) or undefined (toFixed).119*/120function format(x, dp, toE) {121var Big = x.constructor,122123// The index (normal notation) of the digit that may be rounded up.124i = dp - (x = new Big(x)).e,125c = x.c;126127// Round?128if (c.length > ++dp) {129rnd(x, i, Big.RM);130}131132if (!c[0]) {133++i;134} else if (toE) {135i = dp;136137// toFixed138} else {139c = x.c;140141// Recalculate i as x.e may have changed if value rounded up.142i = x.e + i + 1;143}144145// Append zeros?146for (; c.length < i; c.push(0)) {147}148i = x.e;149150/*151* toPrecision returns exponential notation if the number of152* significant digits specified is less than the number of digits153* necessary to represent the integer part of the value in normal154* notation.155*/156return toE === 1 || toE && (dp <= i || i <= Big.E_NEG) ?157158// Exponential notation.159(x.s < 0 && c[0] ? '-' : '') +160(c.length > 1 ? c[0] + '.' + c.join('').slice(1) : c[0]) +161(i < 0 ? 'e' : 'e+') + i162163// Normal notation.164: x.toString();165}166167168/*169* Parse the number or string value passed to a Big constructor.170*171* x {Big} A Big number instance.172* n {number|string} A numeric value.173*/174function parse(x, n) {175var e, i, nL;176177// Minus zero?178if (n === 0 && 1 / n < 0) {179n = '-0';180181// Ensure n is string and check validity.182} else if (!isValid.test(n += '')) {183throwErr(NaN);184}185186// Determine sign.187x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;188189// Decimal point?190if ((e = n.indexOf('.')) > -1) {191n = n.replace('.', '');192}193194// Exponential form?195if ((i = n.search(/e/i)) > 0) {196197// Determine exponent.198if (e < 0) {199e = i;200}201e += +n.slice(i + 1);202n = n.substring(0, i);203204} else if (e < 0) {205206// Integer.207e = n.length;208}209210// Determine leading zeros.211for (i = 0; n.charAt(i) == '0'; i++) {212}213214if (i == (nL = n.length)) {215216// Zero.217x.c = [ x.e = 0 ];218} else {219220// Determine trailing zeros.221for (; n.charAt(--nL) == '0';) {222}223224x.e = e - i - 1;225x.c = [];226227// Convert string to array of digits without leading/trailing zeros.228for (e = 0; i <= nL; x.c[e++] = +n.charAt(i++)) {229}230}231232return x;233}234235236/*237* Round Big x to a maximum of dp decimal places using rounding mode rm.238* Called by div, sqrt and round.239*240* x {Big} The Big to round.241* dp {number} Integer, 0 to MAX_DP inclusive.242* rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP)243* [more] {boolean} Whether the result of division was truncated.244*/245function rnd(x, dp, rm, more) {246var u,247xc = x.c,248i = x.e + dp + 1;249250if (rm === 1) {251252// xc[i] is the digit after the digit that may be rounded up.253more = xc[i] >= 5;254} else if (rm === 2) {255more = xc[i] > 5 || xc[i] == 5 &&256(more || i < 0 || xc[i + 1] !== u || xc[i - 1] & 1);257} else if (rm === 3) {258more = more || xc[i] !== u || i < 0;259} else {260more = false;261262if (rm !== 0) {263throwErr('!Big.RM!');264}265}266267if (i < 1 || !xc[0]) {268269if (more) {270271// 1, 0.1, 0.01, 0.001, 0.0001 etc.272x.e = -dp;273x.c = [1];274} else {275276// Zero.277x.c = [x.e = 0];278}279} else {280281// Remove any digits after the required decimal places.282xc.length = i--;283284// Round up?285if (more) {286287// Rounding up may mean the previous digit has to be rounded up.288for (; ++xc[i] > 9;) {289xc[i] = 0;290291if (!i--) {292++x.e;293xc.unshift(1);294}295}296}297298// Remove trailing zeros.299for (i = xc.length; !xc[--i]; xc.pop()) {300}301}302303return x;304}305306307/*308* Throw a BigError.309*310* message {string} The error message.311*/312function throwErr(message) {313var err = new Error(message);314err.name = 'BigError';315316throw err;317}318319320// Prototype/instance methods321322323/*324* Return a new Big whose value is the absolute value of this Big.325*/326P.abs = function () {327var x = new this.constructor(this);328x.s = 1;329330return x;331};332333334/*335* Return336* 1 if the value of this Big is greater than the value of Big y,337* -1 if the value of this Big is less than the value of Big y, or338* 0 if they have the same value.339*/340P.cmp = function (y) {341var xNeg,342x = this,343xc = x.c,344yc = (y = new x.constructor(y)).c,345i = x.s,346j = y.s,347k = x.e,348l = y.e;349350// Either zero?351if (!xc[0] || !yc[0]) {352return !xc[0] ? !yc[0] ? 0 : -j : i;353}354355// Signs differ?356if (i != j) {357return i;358}359xNeg = i < 0;360361// Compare exponents.362if (k != l) {363return k > l ^ xNeg ? 1 : -1;364}365366i = -1;367j = (k = xc.length) < (l = yc.length) ? k : l;368369// Compare digit by digit.370for (; ++i < j;) {371372if (xc[i] != yc[i]) {373return xc[i] > yc[i] ^ xNeg ? 1 : -1;374}375}376377// Compare lengths.378return k == l ? 0 : k > l ^ xNeg ? 1 : -1;379};380381382/*383* Return a new Big whose value is the value of this Big divided by the384* value of Big y, rounded, if necessary, to a maximum of Big.DP decimal385* places using rounding mode Big.RM.386*/387P.div = function (y) {388var x = this,389Big = x.constructor,390// dividend391dvd = x.c,392//divisor393dvs = (y = new Big(y)).c,394s = x.s == y.s ? 1 : -1,395dp = Big.DP;396397if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {398throwErr('!Big.DP!');399}400401// Either 0?402if (!dvd[0] || !dvs[0]) {403404// If both are 0, throw NaN405if (dvd[0] == dvs[0]) {406throwErr(NaN);407}408409// If dvs is 0, throw +-Infinity.410if (!dvs[0]) {411throwErr(s / 0);412}413414// dvd is 0, return +-0.415return new Big(s * 0);416}417418var dvsL, dvsT, next, cmp, remI, u,419dvsZ = dvs.slice(),420dvdI = dvsL = dvs.length,421dvdL = dvd.length,422// remainder423rem = dvd.slice(0, dvsL),424remL = rem.length,425// quotient426q = y,427qc = q.c = [],428qi = 0,429digits = dp + (q.e = x.e - y.e) + 1;430431q.s = s;432s = digits < 0 ? 0 : digits;433434// Create version of divisor with leading zero.435dvsZ.unshift(0);436437// Add zeros to make remainder as long as divisor.438for (; remL++ < dvsL; rem.push(0)) {439}440441do {442443// 'next' is how many times the divisor goes into current remainder.444for (next = 0; next < 10; next++) {445446// Compare divisor and remainder.447if (dvsL != (remL = rem.length)) {448cmp = dvsL > remL ? 1 : -1;449} else {450451for (remI = -1, cmp = 0; ++remI < dvsL;) {452453if (dvs[remI] != rem[remI]) {454cmp = dvs[remI] > rem[remI] ? 1 : -1;455break;456}457}458}459460// If divisor < remainder, subtract divisor from remainder.461if (cmp < 0) {462463// Remainder can't be more than 1 digit longer than divisor.464// Equalise lengths using divisor with extra leading zero?465for (dvsT = remL == dvsL ? dvs : dvsZ; remL;) {466467if (rem[--remL] < dvsT[remL]) {468remI = remL;469470for (; remI && !rem[--remI]; rem[remI] = 9) {471}472--rem[remI];473rem[remL] += 10;474}475rem[remL] -= dvsT[remL];476}477for (; !rem[0]; rem.shift()) {478}479} else {480break;481}482}483484// Add the 'next' digit to the result array.485qc[qi++] = cmp ? next : ++next;486487// Update the remainder.488if (rem[0] && cmp) {489rem[remL] = dvd[dvdI] || 0;490} else {491rem = [ dvd[dvdI] ];492}493494} while ((dvdI++ < dvdL || rem[0] !== u) && s--);495496// Leading zero? Do not remove if result is simply zero (qi == 1).497if (!qc[0] && qi != 1) {498499// There can't be more than one zero.500qc.shift();501q.e--;502}503504// Round?505if (qi > digits) {506rnd(q, dp, Big.RM, rem[0] !== u);507}508509return q;510};511512513/*514* Return true if the value of this Big is equal to the value of Big y,515* otherwise returns false.516*/517P.eq = function (y) {518return !this.cmp(y);519};520521522/*523* Return true if the value of this Big is greater than the value of Big y,524* otherwise returns false.525*/526P.gt = function (y) {527return this.cmp(y) > 0;528};529530531/*532* Return true if the value of this Big is greater than or equal to the533* value of Big y, otherwise returns false.534*/535P.gte = function (y) {536return this.cmp(y) > -1;537};538539540/*541* Return true if the value of this Big is less than the value of Big y,542* otherwise returns false.543*/544P.lt = function (y) {545return this.cmp(y) < 0;546};547548549/*550* Return true if the value of this Big is less than or equal to the value551* of Big y, otherwise returns false.552*/553P.lte = function (y) {554return this.cmp(y) < 1;555};556557558/*559* Return a new Big whose value is the value of this Big minus the value560* of Big y.561*/562P.sub = P.minus = function (y) {563var i, j, t, xLTy,564x = this,565Big = x.constructor,566a = x.s,567b = (y = new Big(y)).s;568569// Signs differ?570if (a != b) {571y.s = -b;572return x.plus(y);573}574575var xc = x.c.slice(),576xe = x.e,577yc = y.c,578ye = y.e;579580// Either zero?581if (!xc[0] || !yc[0]) {582583// y is non-zero? x is non-zero? Or both are zero.584return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0);585}586587// Determine which is the bigger number.588// Prepend zeros to equalise exponents.589if (a = xe - ye) {590591if (xLTy = a < 0) {592a = -a;593t = xc;594} else {595ye = xe;596t = yc;597}598599t.reverse();600for (b = a; b--; t.push(0)) {601}602t.reverse();603} else {604605// Exponents equal. Check digit by digit.606j = ((xLTy = xc.length < yc.length) ? xc : yc).length;607608for (a = b = 0; b < j; b++) {609610if (xc[b] != yc[b]) {611xLTy = xc[b] < yc[b];612break;613}614}615}616617// x < y? Point xc to the array of the bigger number.618if (xLTy) {619t = xc;620xc = yc;621yc = t;622y.s = -y.s;623}624625/*626* Append zeros to xc if shorter. No need to add zeros to yc if shorter627* as subtraction only needs to start at yc.length.628*/629if (( b = (j = yc.length) - (i = xc.length) ) > 0) {630631for (; b--; xc[i++] = 0) {632}633}634635// Subtract yc from xc.636for (b = i; j > a;){637638if (xc[--j] < yc[j]) {639640for (i = j; i && !xc[--i]; xc[i] = 9) {641}642--xc[i];643xc[j] += 10;644}645xc[j] -= yc[j];646}647648// Remove trailing zeros.649for (; xc[--b] === 0; xc.pop()) {650}651652// Remove leading zeros and adjust exponent accordingly.653for (; xc[0] === 0;) {654xc.shift();655--ye;656}657658if (!xc[0]) {659660// n - n = +0661y.s = 1;662663// Result must be zero.664xc = [ye = 0];665}666667y.c = xc;668y.e = ye;669670return y;671};672673674/*675* Return a new Big whose value is the value of this Big modulo the676* value of Big y.677*/678P.mod = function (y) {679var yGTx,680x = this,681Big = x.constructor,682a = x.s,683b = (y = new Big(y)).s;684685if (!y.c[0]) {686throwErr(NaN);687}688689x.s = y.s = 1;690yGTx = y.cmp(x) == 1;691x.s = a;692y.s = b;693694if (yGTx) {695return new Big(x);696}697698a = Big.DP;699b = Big.RM;700Big.DP = Big.RM = 0;701x = x.div(y);702Big.DP = a;703Big.RM = b;704705return this.minus( x.times(y) );706};707708709/*710* Return a new Big whose value is the value of this Big plus the value711* of Big y.712*/713P.add = P.plus = function (y) {714var t,715x = this,716Big = x.constructor,717a = x.s,718b = (y = new Big(y)).s;719720// Signs differ?721if (a != b) {722y.s = -b;723return x.minus(y);724}725726var xe = x.e,727xc = x.c,728ye = y.e,729yc = y.c;730731// Either zero?732if (!xc[0] || !yc[0]) {733734// y is non-zero? x is non-zero? Or both are zero.735return yc[0] ? y : new Big(xc[0] ? x : a * 0);736}737xc = xc.slice();738739// Prepend zeros to equalise exponents.740// Note: Faster to use reverse then do unshifts.741if (a = xe - ye) {742743if (a > 0) {744ye = xe;745t = yc;746} else {747a = -a;748t = xc;749}750751t.reverse();752for (; a--; t.push(0)) {753}754t.reverse();755}756757// Point xc to the longer array.758if (xc.length - yc.length < 0) {759t = yc;760yc = xc;761xc = t;762}763a = yc.length;764765/*766* Only start adding at yc.length - 1 as the further digits of xc can be767* left as they are.768*/769for (b = 0; a;) {770b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0;771xc[a] %= 10;772}773774// No need to check for zero, as +x + +y != 0 && -x + -y != 0775776if (b) {777xc.unshift(b);778++ye;779}780781// Remove trailing zeros.782for (a = xc.length; xc[--a] === 0; xc.pop()) {783}784785y.c = xc;786y.e = ye;787788return y;789};790791792/*793* Return a Big whose value is the value of this Big raised to the power n.794* If n is negative, round, if necessary, to a maximum of Big.DP decimal795* places using rounding mode Big.RM.796*797* n {number} Integer, -MAX_POWER to MAX_POWER inclusive.798*/799P.pow = function (n) {800var x = this,801one = new x.constructor(1),802y = one,803isNeg = n < 0;804805if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) {806throwErr('!pow!');807}808809n = isNeg ? -n : n;810811for (;;) {812813if (n & 1) {814y = y.times(x);815}816n >>= 1;817818if (!n) {819break;820}821x = x.times(x);822}823824return isNeg ? one.div(y) : y;825};826827828/*829* Return a new Big whose value is the value of this Big rounded to a830* maximum of dp decimal places using rounding mode rm.831* If dp is not specified, round to 0 decimal places.832* If rm is not specified, use Big.RM.833*834* [dp] {number} Integer, 0 to MAX_DP inclusive.835* [rm] 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP)836*/837P.round = function (dp, rm) {838var x = this,839Big = x.constructor;840841if (dp == null) {842dp = 0;843} else if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {844throwErr('!round!');845}846rnd(x = new Big(x), dp, rm == null ? Big.RM : rm);847848return x;849};850851852/*853* Return a new Big whose value is the square root of the value of this Big,854* rounded, if necessary, to a maximum of Big.DP decimal places using855* rounding mode Big.RM.856*/857P.sqrt = function () {858var estimate, r, approx,859x = this,860Big = x.constructor,861xc = x.c,862i = x.s,863e = x.e,864half = new Big('0.5');865866// Zero?867if (!xc[0]) {868return new Big(x);869}870871// If negative, throw NaN.872if (i < 0) {873throwErr(NaN);874}875876// Estimate.877i = Math.sqrt(x.toString());878879// Math.sqrt underflow/overflow?880// Pass x to Math.sqrt as integer, then adjust the result exponent.881if (i === 0 || i === 1 / 0) {882estimate = xc.join('');883884if (!(estimate.length + e & 1)) {885estimate += '0';886}887888r = new Big( Math.sqrt(estimate).toString() );889r.e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);890} else {891r = new Big(i.toString());892}893894i = r.e + (Big.DP += 4);895896// Newton-Raphson iteration.897do {898approx = r;899r = half.times( approx.plus( x.div(approx) ) );900} while ( approx.c.slice(0, i).join('') !==901r.c.slice(0, i).join('') );902903rnd(r, Big.DP -= 4, Big.RM);904905return r;906};907908909/*910* Return a new Big whose value is the value of this Big times the value of911* Big y.912*/913P.mul = P.times = function (y) {914var c,915x = this,916Big = x.constructor,917xc = x.c,918yc = (y = new Big(y)).c,919a = xc.length,920b = yc.length,921i = x.e,922j = y.e;923924// Determine sign of result.925y.s = x.s == y.s ? 1 : -1;926927// Return signed 0 if either 0.928if (!xc[0] || !yc[0]) {929return new Big(y.s * 0);930}931932// Initialise exponent of result as x.e + y.e.933y.e = i + j;934935// If array xc has fewer digits than yc, swap xc and yc, and lengths.936if (a < b) {937c = xc;938xc = yc;939yc = c;940j = a;941a = b;942b = j;943}944945// Initialise coefficient array of result with zeros.946for (c = new Array(j = a + b); j--; c[j] = 0) {947}948949// Multiply.950951// i is initially xc.length.952for (i = b; i--;) {953b = 0;954955// a is yc.length.956for (j = a + i; j > i;) {957958// Current sum of products at this digit position, plus carry.959b = c[j] + yc[i] * xc[j - i - 1] + b;960c[j--] = b % 10;961962// carry963b = b / 10 | 0;964}965c[j] = (c[j] + b) % 10;966}967968// Increment result exponent if there is a final carry.969if (b) {970++y.e;971}972973// Remove any leading zero.974if (!c[0]) {975c.shift();976}977978// Remove trailing zeros.979for (i = c.length; !c[--i]; c.pop()) {980}981y.c = c;982983return y;984};985986987/*988* Return a string representing the value of this Big.989* Return exponential notation if this Big has a positive exponent equal to990* or greater than Big.E_POS, or a negative exponent equal to or less than991* Big.E_NEG.992*/993P.toString = P.valueOf = P.toJSON = function () {994var x = this,995Big = x.constructor,996e = x.e,997str = x.c.join(''),998strL = str.length;9991000// Exponential notation?1001if (e <= Big.E_NEG || e >= Big.E_POS) {1002str = str.charAt(0) + (strL > 1 ? '.' + str.slice(1) : '') +1003(e < 0 ? 'e' : 'e+') + e;10041005// Negative exponent?1006} else if (e < 0) {10071008// Prepend zeros.1009for (; ++e; str = '0' + str) {1010}1011str = '0.' + str;10121013// Positive exponent?1014} else if (e > 0) {10151016if (++e > strL) {10171018// Append zeros.1019for (e -= strL; e-- ; str += '0') {1020}1021} else if (e < strL) {1022str = str.slice(0, e) + '.' + str.slice(e);1023}10241025// Exponent zero.1026} else if (strL > 1) {1027str = str.charAt(0) + '.' + str.slice(1);1028}10291030// Avoid '-0'1031return x.s < 0 && x.c[0] ? '-' + str : str;1032};103310341035/*1036***************************************************************************1037* If toExponential, toFixed, toPrecision and format are not required they1038* can safely be commented-out or deleted. No redundant code will be left.1039* format is used only by toExponential, toFixed and toPrecision.1040***************************************************************************1041*/104210431044/*1045* Return a string representing the value of this Big in exponential1046* notation to dp fixed decimal places and rounded, if necessary, using1047* Big.RM.1048*1049* [dp] {number} Integer, 0 to MAX_DP inclusive.1050*/1051P.toExponential = function (dp) {10521053if (dp == null) {1054dp = this.c.length - 1;1055} else if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {1056throwErr('!toExp!');1057}10581059return format(this, dp, 1);1060};106110621063/*1064* Return a string representing the value of this Big in normal notation1065* to dp fixed decimal places and rounded, if necessary, using Big.RM.1066*1067* [dp] {number} Integer, 0 to MAX_DP inclusive.1068*/1069P.toFixed = function (dp) {1070var str,1071x = this,1072Big = x.constructor,1073neg = Big.E_NEG,1074pos = Big.E_POS;10751076// Prevent the possibility of exponential notation.1077Big.E_NEG = -(Big.E_POS = 1 / 0);10781079if (dp == null) {1080str = x.toString();1081} else if (dp === ~~dp && dp >= 0 && dp <= MAX_DP) {1082str = format(x, x.e + dp);10831084// (-0).toFixed() is '0', but (-0.1).toFixed() is '-0'.1085// (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.1086if (x.s < 0 && x.c[0] && str.indexOf('-') < 0) {1087//E.g. -0.5 if rounded to -0 will cause toString to omit the minus sign.1088str = '-' + str;1089}1090}1091Big.E_NEG = neg;1092Big.E_POS = pos;10931094if (!str) {1095throwErr('!toFix!');1096}10971098return str;1099};110011011102/*1103* Return a string representing the value of this Big rounded to sd1104* significant digits using Big.RM. Use exponential notation if sd is less1105* than the number of digits necessary to represent the integer part of the1106* value in normal notation.1107*1108* sd {number} Integer, 1 to MAX_DP inclusive.1109*/1110P.toPrecision = function (sd) {11111112if (sd == null) {1113return this.toString();1114} else if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {1115throwErr('!toPre!');1116}11171118return format(this, sd - 1, 2);1119};112011211122// Export112311241125Big = bigFactory();11261127//AMD.1128if (typeof define === 'function' && define.amd) {1129define(function () {1130return Big;1131});11321133// Node and other CommonJS-like environments that support module.exports.1134} else if (typeof module !== 'undefined' && module.exports) {1135module.exports = Big;11361137//Browser.1138} else {1139global.Big = Big;1140}1141})(this);114211431144