Comparing version 4.0.2 to 5.0.0
487
big.js
@@ -1,13 +0,10 @@ | ||
/* big.js v4.0.2 https://github.com/MikeMcl/big.js/LICENCE */ | ||
;(function (global) { | ||
'use strict'; | ||
/* | ||
* big.js v4.0.2 | ||
* big.js v5.0.0 | ||
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic. | ||
* https://github.com/MikeMcl/big.js/ | ||
* Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com> | ||
* MIT Expat Licence | ||
* https://github.com/MikeMcl/big.js/LICENCE | ||
*/ | ||
;(function (GLOBAL) { | ||
'use strict'; | ||
var Big, | ||
@@ -17,11 +14,12 @@ | ||
// The default values below must be integers within the stated ranges. | ||
/* | ||
* The maximum number of decimal places (DP) of the results of operations involving division: div | ||
* and sqrt, and pow with negative exponents. | ||
*/ | ||
var DP = 20, // 0 to MAX_DP | ||
// The default values below must be integers within the stated ranges. | ||
/* | ||
* The maximum number of decimal places (DP) of the results of operations involving division: | ||
* div and sqrt, and pow with negative exponents. | ||
*/ | ||
DP = 20, // 0 to MAX_DP | ||
/* | ||
* The rounding mode (RM) used when rounding to the above decimal places. | ||
@@ -57,11 +55,16 @@ * | ||
/**************************************************************************************************/ | ||
// Error messages. | ||
NAME = '[big.js] ', | ||
INVALID = NAME + 'Invalid ', | ||
INVALID_DP = INVALID + 'decimal places', | ||
DIV_BY_ZERO = NAME + 'Division by zero', | ||
// The shared prototype object. | ||
P = {}, | ||
isValid = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, | ||
bigError = '[BigError] ', | ||
undef = void 0, | ||
Big; | ||
UNDEFINED = void 0, | ||
NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; | ||
@@ -73,3 +76,3 @@ | ||
*/ | ||
function bigFactory() { | ||
function factory() { | ||
@@ -86,3 +89,3 @@ /* | ||
// Enable constructor usage without new. | ||
if (!(x instanceof Big)) return n === undef ? bigFactory() : new Big(n); | ||
if (!(x instanceof Big)) return n === UNDEFINED ? factory() : new Big(n); | ||
@@ -110,2 +113,3 @@ // Duplicate. | ||
Big.PE = PE; | ||
Big.version = '4.0.2'; | ||
@@ -116,52 +120,3 @@ return Big; | ||
// Private functions | ||
/* | ||
* Return a string representing the value of Big x in normal or exponential notation to dp fixed | ||
* decimal places or significant digits. | ||
* | ||
* x {Big} The Big to format. | ||
* dp {number} Integer, 0 to MAX_DP inclusive. | ||
* toE {number} 1 (toExponential), 2 (toPrecision) or undefined (toFixed). | ||
*/ | ||
function format(x, dp, toE) { | ||
var Big = x.constructor, | ||
// The index (normal notation) of the digit that may be rounded up. | ||
i = dp - (x = new Big(x)).e, | ||
c = x.c; | ||
// Round? | ||
if (c.length > ++dp) rnd(x, i, Big.RM); | ||
if (!c[0]) { | ||
++i; | ||
} else if (toE) { | ||
i = dp; | ||
// toFixed | ||
} else { | ||
c = x.c; | ||
// Recalculate i as x.e may have changed if value rounded up. | ||
i = x.e + i + 1; | ||
} | ||
// Append zeros? | ||
for (; c.length < i;) c.push(0); | ||
i = x.e; | ||
/* | ||
* toPrecision returns exponential notation if the number of significant digits specified is | ||
* less than the number of digits necessary to represent the integer part of the value in | ||
* normal notation. | ||
*/ | ||
return toE === 1 || toE && (dp <= i || i <= Big.NE) ? (x.s < 0 && c[0] ? '-' : '') + | ||
(c.length > 1 ? c[0] + '.' + c.join('').slice(1) : c[0]) + (i < 0 ? 'e' : 'e+') + i | ||
: x.toString(); | ||
} | ||
/* | ||
* Parse the number or string value passed to a Big constructor. | ||
@@ -173,7 +128,7 @@ * | ||
function parse(x, n) { | ||
var e, i, nL; | ||
var e, i, nl; | ||
// Minus zero? | ||
if (n === 0 && 1 / n < 0) n = '-0'; | ||
else if (!isValid.test(n += '')) throw Error(bigError + NaN); | ||
else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number'); | ||
@@ -199,8 +154,8 @@ // Determine sign. | ||
nL = n.length; | ||
nl = n.length; | ||
// Determine leading zeros. | ||
for (i = 0; i < nL && n.charAt(i) == '0';) ++i; | ||
for (i = 0; i < nl && n.charAt(i) == '0';) ++i; | ||
if (i == nL) { | ||
if (i == nl) { | ||
@@ -212,3 +167,3 @@ // Zero. | ||
// Determine trailing zeros. | ||
for (; nL > 0 && n.charAt(--nL) == '0';); | ||
for (; nl > 0 && n.charAt(--nl) == '0';); | ||
x.e = e - i - 1; | ||
@@ -218,3 +173,3 @@ x.c = []; | ||
// Convert string to array of digits without leading/trailing zeros. | ||
for (e = 0; i <= nL;) x.c[e++] = +n.charAt(i++); | ||
for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++); | ||
} | ||
@@ -228,3 +183,3 @@ | ||
* Round Big x to a maximum of dp decimal places using rounding mode rm. | ||
* Called by div, sqrt and round. | ||
* Called by stringify, P.div, P.round and P.sqrt. | ||
* | ||
@@ -236,3 +191,3 @@ * x {Big} The Big to round. | ||
*/ | ||
function rnd(x, dp, rm, more) { | ||
function round(x, dp, rm, more) { | ||
var xc = x.c, | ||
@@ -246,11 +201,12 @@ i = x.e + dp + 1; | ||
} else if (rm === 2) { | ||
more = xc[i] > 5 || xc[i] == 5 && (more || i < 0 || xc[i + 1] !== undef || xc[i - 1] & 1); | ||
more = xc[i] > 5 || xc[i] == 5 && (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1); | ||
} else if (rm === 3) { | ||
more = more || xc[i] !== undef || i < 0; | ||
more = more || xc[i] !== UNDEFINED || i < 0; | ||
} else { | ||
more = false; | ||
if (rm !== 0) throw Error(bigError + 'RM: ' + rm); | ||
if (rm !== 0) throw Error(INVALID + 'rounding mode'); | ||
} | ||
if (i < 1 || !xc[0]) { | ||
xc.length = 1; | ||
if (more) { | ||
@@ -260,7 +216,7 @@ | ||
x.e = -dp; | ||
x.c = [1]; | ||
xc[0] = 1; | ||
} else { | ||
// Zero. | ||
x.c = [x.e = 0]; | ||
xc[0] = x.e = 0; | ||
} | ||
@@ -293,2 +249,63 @@ } else { | ||
/* | ||
* Return a string representing the value of Big x in normal or exponential notation. | ||
* Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf. | ||
* | ||
* x {Big} | ||
* id? {number} Caller id. | ||
* 1 toExponential | ||
* 2 toFixed | ||
* 3 toPrecision | ||
* 4 valueOf | ||
* n? {number|undefined} Caller's argument. | ||
* k? {number|undefined} | ||
*/ | ||
function stringify(x, id, n, k) { | ||
var e, s, | ||
Big = x.constructor, | ||
z = !x.c[0]; | ||
if (n !== UNDEFINED) { | ||
if (n !== ~~n || n < (id == 3) || n > MAX_DP) { | ||
throw Error(id == 3 ? INVALID + 'precision' : INVALID_DP); | ||
} | ||
x = new Big(x); | ||
// The index of the digit that may be rounded up. | ||
n = k - x.e; | ||
// Round? | ||
if (x.c.length > ++k) round(x, n, Big.RM); | ||
// toFixed: recalculate k as x.e may have changed if value rounded up. | ||
if (id == 2) k = x.e + n + 1; | ||
// Append zeros? | ||
for (; x.c.length < k;) x.c.push(0); | ||
} | ||
e = x.e; | ||
s = x.c.join(''); | ||
n = s.length; | ||
// Exponential notation? | ||
if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) { | ||
s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e; | ||
// Normal notation. | ||
} else if (e < 0) { | ||
for (; ++e;) s = '0' + s; | ||
s = '0.' + s; | ||
} else if (e > 0) { | ||
if (++e > n) for (e -= n; e--;) s += '0'; | ||
else if (e < n) s = s.slice(0, e) + '.' + s.slice(e); | ||
} else if (n > 1) { | ||
s = s.charAt(0) + '.' + s.slice(1); | ||
} | ||
return x.s < 0 && (!z || id == 4) ? '-' + s : s; | ||
} | ||
// Prototype/instance methods | ||
@@ -313,3 +330,3 @@ | ||
P.cmp = function (y) { | ||
var xNeg, | ||
var isneg, | ||
x = this, | ||
@@ -329,17 +346,16 @@ xc = x.c, | ||
xNeg = i < 0; | ||
isneg = i < 0; | ||
// Compare exponents. | ||
if (k != l) return k > l ^ xNeg ? 1 : -1; | ||
if (k != l) return k > l ^ isneg ? 1 : -1; | ||
i = -1; | ||
j = (k = xc.length) < (l = yc.length) ? k : l; | ||
// Compare digit by digit. | ||
for (; ++i < j;) { | ||
if (xc[i] != yc[i]) return xc[i] > yc[i] ^ xNeg ? 1 : -1; | ||
for (i = -1; ++i < j;) { | ||
if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1; | ||
} | ||
// Compare lengths. | ||
return k == l ? 0 : k > l ^ xNeg ? 1 : -1; | ||
return k == l ? 0 : k > l ^ isneg ? 1 : -1; | ||
}; | ||
@@ -355,54 +371,47 @@ | ||
Big = x.constructor, | ||
dvd = x.c, // dividend | ||
dvs = (y = new Big(y)).c, // divisor | ||
s = x.s == y.s ? 1 : -1, | ||
a = x.c, // dividend | ||
b = (y = new Big(y)).c, // divisor | ||
k = x.s == y.s ? 1 : -1, | ||
dp = Big.DP; | ||
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(bigError + 'DP: ' + dp); | ||
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP); | ||
// Either 0? | ||
if (!dvd[0] || !dvs[0]) { | ||
// Divisor is zero? | ||
if (!b[0]) throw Error(DIV_BY_ZERO); | ||
// If both are 0, throw NaN | ||
if (dvd[0] == dvs[0]) throw Error(bigError + NaN); | ||
// Dividend is 0? Return +-0. | ||
if (!a[0]) return new Big(k * 0); | ||
// If dvs is 0, throw +-Infinity. | ||
if (!dvs[0]) throw Error(bigError + s / 0); | ||
// dvd is 0, return +-0. | ||
return new Big(s * 0); | ||
} | ||
var dvsL, dvsT, next, cmp, remI, | ||
dvsZ = dvs.slice(), | ||
dvdI = dvsL = dvs.length, | ||
dvdL = dvd.length, | ||
rem = dvd.slice(0, dvsL), // remainder | ||
remL = rem.length, | ||
q = y, // quotient | ||
var bl, bt, n, cmp, ri, | ||
bz = b.slice(), | ||
ai = bl = b.length, | ||
al = a.length, | ||
r = a.slice(0, bl), // remainder | ||
rl = r.length, | ||
q = y, // quotient | ||
qc = q.c = [], | ||
qi = 0, | ||
digits = dp + (q.e = x.e - y.e) + 1; | ||
d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result | ||
q.s = s; | ||
s = digits < 0 ? 0 : digits; | ||
q.s = k; | ||
k = d < 0 ? 0 : d; | ||
// Create version of divisor with leading zero. | ||
dvsZ.unshift(0); | ||
bz.unshift(0); | ||
// Add zeros to make remainder as long as divisor. | ||
for (; remL++ < dvsL;) rem.push(0); | ||
for (; rl++ < bl;) r.push(0); | ||
do { | ||
// 'next' is how many times the divisor goes into current remainder. | ||
for (next = 0; next < 10; next++) { | ||
// n is how many times the divisor goes into current remainder. | ||
for (n = 0; n < 10; n++) { | ||
// Compare divisor and remainder. | ||
if (dvsL != (remL = rem.length)) { | ||
cmp = dvsL > remL ? 1 : -1; | ||
if (bl != (rl = r.length)) { | ||
cmp = bl > rl ? 1 : -1; | ||
} else { | ||
for (remI = -1, cmp = 0; ++remI < dvsL;) { | ||
if (dvs[remI] != rem[remI]) { | ||
cmp = dvs[remI] > rem[remI] ? 1 : -1; | ||
for (ri = -1, cmp = 0; ++ri < bl;) { | ||
if (b[ri] != r[ri]) { | ||
cmp = b[ri] > r[ri] ? 1 : -1; | ||
break; | ||
@@ -418,14 +427,13 @@ } | ||
// Equalise lengths using divisor with extra leading zero? | ||
for (dvsT = remL == dvsL ? dvs : dvsZ; remL;) { | ||
if (rem[--remL] < dvsT[remL]) { | ||
remI = remL; | ||
for (; remI && !rem[--remI];) rem[remI] = 9; | ||
--rem[remI]; | ||
rem[remL] += 10; | ||
for (bt = rl == bl ? b : bz; rl;) { | ||
if (r[--rl] < bt[rl]) { | ||
ri = rl; | ||
for (; ri && !r[--ri];) r[ri] = 9; | ||
--r[ri]; | ||
r[rl] += 10; | ||
} | ||
rem[remL] -= dvsT[remL]; | ||
r[rl] -= bt[rl]; | ||
} | ||
for (; !rem[0];) rem.shift(); | ||
for (; !r[0];) r.shift(); | ||
} else { | ||
@@ -436,10 +444,10 @@ break; | ||
// Add the 'next' digit to the result array. | ||
qc[qi++] = cmp ? next : ++next; | ||
// Add the digit n to the result array. | ||
qc[qi++] = cmp ? n : ++n; | ||
// Update the remainder. | ||
if (rem[0] && cmp) rem[remL] = dvd[dvdI] || 0; | ||
else rem = [dvd[dvdI]]; | ||
if (r[0] && cmp) r[rl] = a[ai] || 0; | ||
else r = [a[ai]]; | ||
} while ((dvdI++ < dvdL || rem[0] !== undef) && s--); | ||
} while ((ai++ < al || r[0] !== UNDEFINED) && k--); | ||
@@ -455,3 +463,3 @@ // Leading zero? Do not remove if result is simply zero (qi == 1). | ||
// Round? | ||
if (qi > digits) rnd(q, dp, Big.RM, rem[0] !== undef); | ||
if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED); | ||
@@ -508,4 +516,4 @@ return q; | ||
*/ | ||
P.sub = P.minus = function (y) { | ||
var i, j, t, xLTy, | ||
P.minus = P.sub = function (y) { | ||
var i, j, t, xlty, | ||
x = this, | ||
@@ -537,3 +545,3 @@ Big = x.constructor, | ||
if (xLTy = a < 0) { | ||
if (xlty = a < 0) { | ||
a = -a; | ||
@@ -552,7 +560,7 @@ t = xc; | ||
// Exponents equal. Check digit by digit. | ||
j = ((xLTy = xc.length < yc.length) ? xc : yc).length; | ||
j = ((xlty = xc.length < yc.length) ? xc : yc).length; | ||
for (a = b = 0; b < j; b++) { | ||
if (xc[b] != yc[b]) { | ||
xLTy = xc[b] < yc[b]; | ||
xlty = xc[b] < yc[b]; | ||
break; | ||
@@ -564,3 +572,3 @@ } | ||
// x < y? Point xc to the array of the bigger number. | ||
if (xLTy) { | ||
if (xlty) { | ||
t = xc; | ||
@@ -618,3 +626,3 @@ xc = yc; | ||
P.mod = function (y) { | ||
var yGTx, | ||
var ygtx, | ||
x = this, | ||
@@ -625,9 +633,10 @@ Big = x.constructor, | ||
if (!y.c[0]) throw Error(bigError + NaN); | ||
if (!y.c[0]) throw Error(DIV_BY_ZERO); | ||
x.s = y.s = 1; | ||
yGTx = y.cmp(x) == 1; | ||
ygtx = y.cmp(x) == 1; | ||
x.s = a; | ||
y.s = b; | ||
if (yGTx) return new Big(x); | ||
if (ygtx) return new Big(x); | ||
@@ -648,3 +657,3 @@ a = Big.DP; | ||
*/ | ||
P.add = P.plus = function (y) { | ||
P.plus = P.add = function (y) { | ||
var t, | ||
@@ -719,3 +728,3 @@ x = this, | ||
* Return a Big whose value is the value of this Big raised to the power n. | ||
* If n is negative, round, if necessary, to a maximum of Big.DP decimal places using rounding | ||
* If n is negative, round to a maximum of Big.DP decimal places using rounding | ||
* mode Big.RM. | ||
@@ -729,6 +738,6 @@ * | ||
y = one, | ||
isNeg = n < 0; | ||
isneg = n < 0; | ||
if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(bigError + n); | ||
n = isNeg ? -n : n; | ||
if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + 'exponent'); | ||
if (isneg) n = -n; | ||
@@ -742,3 +751,3 @@ for (;;) { | ||
return isNeg ? one.div(y) : y; | ||
return isneg ? one.div(y) : y; | ||
}; | ||
@@ -753,13 +762,10 @@ | ||
* | ||
* [dp] {number} Integer, 0 to MAX_DP inclusive. | ||
* [rm] 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP) | ||
* dp? {number} Integer, 0 to MAX_DP inclusive. | ||
* rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP) | ||
*/ | ||
P.round = function (dp, rm) { | ||
var x = this, | ||
Big = x.constructor; | ||
if (dp === undef) dp = 0; | ||
else if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(bigError + dp); | ||
return rnd(new Big(x), dp, rm === undef ? Big.RM : rm); | ||
var Big = this.constructor; | ||
if (dp === UNDEFINED) dp = 0; | ||
else if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP); | ||
return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm); | ||
}; | ||
@@ -773,39 +779,38 @@ | ||
P.sqrt = function () { | ||
var estimate, r, approx, | ||
var r, c, t, | ||
x = this, | ||
Big = x.constructor, | ||
xc = x.c, | ||
i = x.s, | ||
s = x.s, | ||
e = x.e, | ||
half = new Big('0.5'); | ||
half = new Big(0.5); | ||
// Zero? | ||
if (!xc[0]) return new Big(x); | ||
if (!x.c[0]) return new Big(x); | ||
// If negative, throw NaN. | ||
if (i < 0) throw Error(bigError + NaN); | ||
// Negative? | ||
if (s < 0) throw Error(NAME + 'No square root'); | ||
// Estimate. | ||
i = Math.sqrt(x.toString()); | ||
s = Math.sqrt(x.toString()); | ||
// Math.sqrt underflow/overflow? | ||
// Pass x to Math.sqrt as integer, then adjust the result exponent. | ||
if (i === 0 || i === 1 / 0) { | ||
estimate = xc.join(''); | ||
if (!(estimate.length + e & 1)) estimate += '0'; | ||
r = new Big(Math.sqrt(estimate).toString()); | ||
// Re-estimate: pass x to Math.sqrt as integer, then adjust the result exponent. | ||
if (s === 0 || s === 1 / 0) { | ||
c = x.c.join(''); | ||
if (!(c.length + e & 1)) c += '0'; | ||
r = new Big(Math.sqrt(c).toString()); | ||
r.e = ((e + 1) / 2 | 0) - (e < 0 || e & 1); | ||
} else { | ||
r = new Big(i.toString()); | ||
r = new Big(s.toString()); | ||
} | ||
i = r.e + (Big.DP += 4); | ||
e = r.e + (Big.DP += 4); | ||
// Newton-Raphson iteration. | ||
do { | ||
approx = r; | ||
r = half.times(approx.plus(x.div(approx))); | ||
} while (approx.c.slice(0, i).join('') !== r.c.slice(0, i).join('')); | ||
t = r; | ||
r = half.times(t.plus(x.div(t))); | ||
} while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join('')); | ||
return rnd(r, Big.DP -= 4, Big.RM); | ||
return round(r, Big.DP -= 4, Big.RM); | ||
}; | ||
@@ -817,3 +822,3 @@ | ||
*/ | ||
P.mul = P.times = function (y) { | ||
P.times = P.mul = function (y) { | ||
var c, | ||
@@ -884,50 +889,9 @@ x = this, | ||
/* | ||
* Return a string representing the value of this Big. | ||
* Return exponential notation if this Big has a positive exponent equal to or greater than | ||
* Big.PE, or a negative exponent equal to or less than Big.NE. | ||
*/ | ||
P.toString = P.valueOf = P.toJSON = function () { | ||
var x = this, | ||
Big = x.constructor, | ||
e = x.e, | ||
str = x.c.join(''), | ||
strL = str.length; | ||
// Exponential notation? | ||
if (e <= Big.NE || e >= Big.PE) { | ||
str = str.charAt(0) + (strL > 1 ? '.' + str.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e; | ||
} else if (e < 0) { | ||
for (; ++e;) str = '0' + str; | ||
str = '0.' + str; | ||
} else if (e > 0) { | ||
if (++e > strL) for (e -= strL; e--;) str += '0'; | ||
else if (e < strL) str = str.slice(0, e) + '.' + str.slice(e); | ||
// Exponent is zero. | ||
} else if (strL > 1) { | ||
str = str.charAt(0) + '.' + str.slice(1); | ||
} | ||
// Avoid '-0' | ||
return x.s < 0 && x.c[0] ? '-' + str : str; | ||
}; | ||
/* | ||
* If toExponential, toFixed, toPrecision and format are not required they can safely be | ||
* commented-out or deleted. No redundant code will be left. | ||
* The format function is used only by toExponential, toFixed and toPrecision. | ||
*/ | ||
/* | ||
* Return a string representing the value of this Big in exponential notation to dp fixed decimal | ||
* places and rounded, if necessary, using Big.RM. | ||
* places and rounded using Big.RM. | ||
* | ||
* [dp] {number} Integer, 0 to MAX_DP inclusive. | ||
* dp? {number} Integer, 0 to MAX_DP inclusive. | ||
*/ | ||
P.toExponential = function (dp) { | ||
if (dp === undef) dp = this.c.length - 1; | ||
else if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(bigError + dp); | ||
return format(this, dp, 1); | ||
return stringify(this, 1, dp, dp); | ||
}; | ||
@@ -938,36 +902,11 @@ | ||
* Return a string representing the value of this Big in normal notation to dp fixed decimal | ||
* places and rounded, if necessary, using Big.RM. | ||
* places and rounded using Big.RM. | ||
* | ||
* [dp] {number} Integer, 0 to MAX_DP inclusive. | ||
* dp? {number} Integer, 0 to MAX_DP inclusive. | ||
* | ||
* (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. | ||
* (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. | ||
*/ | ||
P.toFixed = function (dp) { | ||
var str, | ||
x = this, | ||
Big = x.constructor, | ||
ne = Big.NE, | ||
pe = Big.PE; | ||
// Prevent the possibility of exponential notation. | ||
Big.NE = -(Big.PE = 1 / 0); | ||
if (dp === undef) { | ||
str = x.toString(); | ||
} else if (dp === ~~dp && dp >= 0 && dp <= MAX_DP) { | ||
str = format(x, x.e + dp); | ||
// (-0).toFixed() is '0', but (-0.1).toFixed() is '-0'. | ||
// (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. | ||
if (x.s < 0 && x.c[0] && str.indexOf('-') < 0) { | ||
//E.g. -0.5 if rounded to -0 will cause toString to omit the minus sign. | ||
str = '-' + str; | ||
} | ||
} | ||
Big.NE = ne; | ||
Big.PE = pe; | ||
if (!str) throw Error(bigError + dp); | ||
return str; | ||
return stringify(this, 2, dp, this.e + dp); | ||
}; | ||
@@ -984,12 +923,32 @@ | ||
P.toPrecision = function (sd) { | ||
if (sd === undef) return this.toString(); | ||
else if (sd !== ~~sd || sd < 1 || sd > MAX_DP) throw Error(bigError + sd); | ||
return format(this, sd - 1, 2); | ||
return stringify(this, 3, sd, sd - 1); | ||
}; | ||
/* | ||
* Return a string representing the value of this Big. | ||
* Return exponential notation if this Big has a positive exponent equal to or greater than | ||
* Big.PE, or a negative exponent equal to or less than Big.NE. | ||
* Omit the sign for negative zero. | ||
*/ | ||
P.toString = function () { | ||
return stringify(this); | ||
}; | ||
/* | ||
* Return a string representing the value of this Big. | ||
* Return exponential notation if this Big has a positive exponent equal to or greater than | ||
* Big.PE, or a negative exponent equal to or less than Big.NE. | ||
* Include the sign for negative zero. | ||
*/ | ||
P.valueOf = P.toJSON = function () { | ||
return stringify(this, 4); | ||
}; | ||
// Export | ||
Big = bigFactory(); | ||
Big = factory(); | ||
@@ -1008,4 +967,4 @@ Big['default'] = Big.Big = Big; | ||
} else { | ||
global.Big = Big; | ||
GLOBAL.Big = Big; | ||
} | ||
})(this); |
@@ -1,3 +0,3 @@ | ||
/* big.js v4.0.2 https://github.com/MikeMcl/big.js/LICENCE */ | ||
!function(r){"use strict";function e(){function r(t){var i=this;return i instanceof r?(t instanceof r?(i.s=t.s,i.e=t.e,i.c=t.c.slice()):n(i,t),void(i.constructor=r)):t===p?e():new r(t)}return r.prototype=a,r.DP=s,r.RM=f,r.NE=h,r.PE=l,r}function t(r,e,t){var n=r.constructor,o=e-(r=new n(r)).e,s=r.c;for(s.length>++e&&i(r,o,n.RM),s[0]?t?o=e:(s=r.c,o=r.e+o+1):++o;s.length<o;)s.push(0);return o=r.e,1===t||t&&(o>=e||o<=n.NE)?(r.s<0&&s[0]?"-":"")+(s.length>1?s[0]+"."+s.join("").slice(1):s[0])+(0>o?"e":"e+")+o:r.toString()}function n(r,e){var t,n,i;if(0===e&&0>1/e)e="-0";else if(!g.test(e+=""))throw Error(w+NaN);for(r.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(0>t&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):0>t&&(t=e.length),i=e.length,n=0;i>n&&"0"==e.charAt(n);)++n;if(n==i)r.c=[r.e=0];else{for(;i>0&&"0"==e.charAt(--i););for(r.e=t-n-1,r.c=[],t=0;i>=n;)r.c[t++]=+e.charAt(n++)}return r}function i(r,e,t,n){var i=r.c,o=r.e+e+1;if(1===t)n=i[o]>=5;else if(2===t)n=i[o]>5||5==i[o]&&(n||0>o||i[o+1]!==p||1&i[o-1]);else if(3===t)n=n||i[o]!==p||0>o;else if(n=!1,0!==t)throw Error(w+"RM: "+t);if(1>o||!i[0])n?(r.e=-e,r.c=[1]):r.c=[r.e=0];else{if(i.length=o--,n)for(;++i[o]>9;)i[o]=0,o--||(++r.e,i.unshift(1));for(o=i.length;!i[--o];)i.pop()}return r}var o,s=20,f=1,c=1e6,u=1e6,h=-7,l=21,a={},g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,w="[BigError] ",p=void 0;a.abs=function(){var r=new this.constructor(this);return r.s=1,r},a.cmp=function(r){var e,t=this,n=t.c,i=(r=new t.constructor(r)).c,o=t.s,s=r.s,f=t.e,c=r.e;if(!n[0]||!i[0])return n[0]?o:i[0]?-s:0;if(o!=s)return o;if(e=0>o,f!=c)return f>c^e?1:-1;for(o=-1,s=(f=n.length)<(c=i.length)?f:c;++o<s;)if(n[o]!=i[o])return n[o]>i[o]^e?1:-1;return f==c?0:f>c^e?1:-1},a.div=function(r){var e=this,t=e.constructor,n=e.c,o=(r=new t(r)).c,s=e.s==r.s?1:-1,f=t.DP;if(f!==~~f||0>f||f>c)throw Error(w+"DP: "+f);if(!n[0]||!o[0]){if(n[0]==o[0])throw Error(w+NaN);if(!o[0])throw Error(w+s/0);return new t(0*s)}var u,h,l,a,g,v=o.slice(),d=u=o.length,E=n.length,m=n.slice(0,u),N=m.length,P=r,M=P.c=[],R=0,D=f+(P.e=e.e-r.e)+1;for(P.s=s,s=0>D?0:D,v.unshift(0);N++<u;)m.push(0);do{for(l=0;10>l;l++){if(u!=(N=m.length))a=u>N?1:-1;else for(g=-1,a=0;++g<u;)if(o[g]!=m[g]){a=o[g]>m[g]?1:-1;break}if(!(0>a))break;for(h=N==u?o:v;N;){if(m[--N]<h[N]){for(g=N;g&&!m[--g];)m[g]=9;--m[g],m[N]+=10}m[N]-=h[N]}for(;!m[0];)m.shift()}M[R++]=a?l:++l,m[0]&&a?m[N]=n[d]||0:m=[n[d]]}while((d++<E||m[0]!==p)&&s--);return M[0]||1==R||(M.shift(),P.e--),R>D&&i(P,f,t.RM,m[0]!==p),P},a.eq=function(r){return!this.cmp(r)},a.gt=function(r){return this.cmp(r)>0},a.gte=function(r){return this.cmp(r)>-1},a.lt=function(r){return this.cmp(r)<0},a.lte=function(r){return this.cmp(r)<1},a.sub=a.minus=function(r){var e,t,n,i,o=this,s=o.constructor,f=o.s,c=(r=new s(r)).s;if(f!=c)return r.s=-c,o.plus(r);var u=o.c.slice(),h=o.e,l=r.c,a=r.e;if(!u[0]||!l[0])return l[0]?(r.s=-c,r):new s(u[0]?o:0);if(f=h-a){for((i=0>f)?(f=-f,n=u):(a=h,n=l),n.reverse(),c=f;c--;)n.push(0);n.reverse()}else for(t=((i=u.length<l.length)?u:l).length,f=c=0;t>c;c++)if(u[c]!=l[c]){i=u[c]<l[c];break}if(i&&(n=u,u=l,l=n,r.s=-r.s),(c=(t=l.length)-(e=u.length))>0)for(;c--;)u[e++]=0;for(c=e;t>f;){if(u[--t]<l[t]){for(e=t;e&&!u[--e];)u[e]=9;--u[e],u[t]+=10}u[t]-=l[t]}for(;0===u[--c];)u.pop();for(;0===u[0];)u.shift(),--a;return u[0]||(r.s=1,u=[a=0]),r.c=u,r.e=a,r},a.mod=function(r){var e,t=this,n=t.constructor,i=t.s,o=(r=new n(r)).s;if(!r.c[0])throw Error(w+NaN);return t.s=r.s=1,e=1==r.cmp(t),t.s=i,r.s=o,e?new n(t):(i=n.DP,o=n.RM,n.DP=n.RM=0,t=t.div(r),n.DP=i,n.RM=o,this.minus(t.times(r)))},a.add=a.plus=function(r){var e,t=this,n=t.constructor,i=t.s,o=(r=new n(r)).s;if(i!=o)return r.s=-o,t.minus(r);var s=t.e,f=t.c,c=r.e,u=r.c;if(!f[0]||!u[0])return u[0]?r:new n(f[0]?t:0*i);if(f=f.slice(),i=s-c){for(i>0?(c=s,e=u):(i=-i,e=f),e.reverse();i--;)e.push(0);e.reverse()}for(f.length-u.length<0&&(e=u,u=f,f=e),i=u.length,o=0;i;f[i]%=10)o=(f[--i]=f[i]+u[i]+o)/10|0;for(o&&(f.unshift(o),++c),i=f.length;0===f[--i];)f.pop();return r.c=f,r.e=c,r},a.pow=function(r){var e=this,t=new e.constructor(1),n=t,i=0>r;if(r!==~~r||-u>r||r>u)throw Error(w+r);for(r=i?-r:r;1&r&&(n=n.times(e)),r>>=1,r;)e=e.times(e);return i?t.div(n):n},a.round=function(r,e){var t=this,n=t.constructor;if(r===p)r=0;else if(r!==~~r||0>r||r>c)throw Error(w+r);return i(new n(t),r,e===p?n.RM:e)},a.sqrt=function(){var r,e,t,n=this,o=n.constructor,s=n.c,f=n.s,c=n.e,u=new o("0.5");if(!s[0])return new o(n);if(0>f)throw Error(w+NaN);f=Math.sqrt(n.toString()),0===f||f===1/0?(r=s.join(""),r.length+c&1||(r+="0"),e=new o(Math.sqrt(r).toString()),e.e=((c+1)/2|0)-(0>c||1&c)):e=new o(f.toString()),f=e.e+(o.DP+=4);do t=e,e=u.times(t.plus(n.div(t)));while(t.c.slice(0,f).join("")!==e.c.slice(0,f).join(""));return i(e,o.DP-=4,o.RM)},a.mul=a.times=function(r){var e,t=this,n=t.constructor,i=t.c,o=(r=new n(r)).c,s=i.length,f=o.length,c=t.e,u=r.e;if(r.s=t.s==r.s?1:-1,!i[0]||!o[0])return new n(0*r.s);for(r.e=c+u,f>s&&(e=i,i=o,o=e,u=s,s=f,f=u),e=new Array(u=s+f);u--;)e[u]=0;for(c=f;c--;){for(f=0,u=s+c;u>c;)f=e[u]+o[c]*i[u-c-1]+f,e[u--]=f%10,f=f/10|0;e[u]=(e[u]+f)%10}for(f?++r.e:e.shift(),c=e.length;!e[--c];)e.pop();return r.c=e,r},a.toString=a.valueOf=a.toJSON=function(){var r=this,e=r.constructor,t=r.e,n=r.c.join(""),i=n.length;if(t<=e.NE||t>=e.PE)n=n.charAt(0)+(i>1?"."+n.slice(1):"")+(0>t?"e":"e+")+t;else if(0>t){for(;++t;)n="0"+n;n="0."+n}else if(t>0)if(++t>i)for(t-=i;t--;)n+="0";else i>t&&(n=n.slice(0,t)+"."+n.slice(t));else i>1&&(n=n.charAt(0)+"."+n.slice(1));return r.s<0&&r.c[0]?"-"+n:n},a.toExponential=function(r){if(r===p)r=this.c.length-1;else if(r!==~~r||0>r||r>c)throw Error(w+r);return t(this,r,1)},a.toFixed=function(r){var e,n=this,i=n.constructor,o=i.NE,s=i.PE;if(i.NE=-(i.PE=1/0),r===p?e=n.toString():r===~~r&&r>=0&&c>=r&&(e=t(n,n.e+r),n.s<0&&n.c[0]&&e.indexOf("-")<0&&(e="-"+e)),i.NE=o,i.PE=s,!e)throw Error(w+r);return e},a.toPrecision=function(r){if(r===p)return this.toString();if(r!==~~r||1>r||r>c)throw Error(w+r);return t(this,r-1,2)},o=e(),o["default"]=o.Big=o,"function"==typeof define&&define.amd?define(function(){return o}):"undefined"!=typeof module&&module.exports?module.exports=o:r.Big=o}(this); | ||
/* big.js v5.0.0 https://github.com/MikeMcl/big.js/LICENCE */ | ||
!function(e){"use strict";function r(){function e(n){var i=this;return i instanceof e?(n instanceof e?(i.s=n.s,i.e=n.e,i.c=n.c.slice()):t(i,n),void(i.constructor=e)):n===v?r():new e(n)}return e.prototype=d,e.DP=s,e.RM=f,e.NE=h,e.PE=l,e.version="4.0.2",e}function t(e,r){var t,n,i;if(0===r&&0>1/r)r="-0";else if(!m.test(r+=""))throw Error(g+"number");for(e.s="-"==r.charAt(0)?(r=r.slice(1),-1):1,(t=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(0>t&&(t=n),t+=+r.slice(n+1),r=r.substring(0,n)):0>t&&(t=r.length),i=r.length,n=0;i>n&&"0"==r.charAt(n);)++n;if(n==i)e.c=[e.e=0];else{for(;i>0&&"0"==r.charAt(--i););for(e.e=t-n-1,e.c=[],t=0;i>=n;)e.c[t++]=+r.charAt(n++)}return e}function n(e,r,t,n){var i=e.c,o=e.e+r+1;if(1===t)n=i[o]>=5;else if(2===t)n=i[o]>5||5==i[o]&&(n||0>o||i[o+1]!==v||1&i[o-1]);else if(3===t)n=n||i[o]!==v||0>o;else if(n=!1,0!==t)throw Error(g+"rounding mode");if(1>o||!i[0])i.length=1,n?(e.e=-r,i[0]=1):i[0]=e.e=0;else{if(i.length=o--,n)for(;++i[o]>9;)i[o]=0,o--||(++e.e,i.unshift(1));for(o=i.length;!i[--o];)i.pop()}return e}function i(e,r,t,i){var o,s,f=e.constructor,u=!e.c[0];if(t!==v){if(t!==~~t||(3==r)>t||t>c)throw Error(3==r?g+"precision":p);for(e=new f(e),t=i-e.e,e.c.length>++i&&n(e,t,f.RM),2==r&&(i=e.e+t+1);e.c.length<i;)e.c.push(0)}if(o=e.e,s=e.c.join(""),t=s.length,2!=r&&(1==r||3==r&&o>=i||o<=f.NE||o>=f.PE))s=s.charAt(0)+(t>1?"."+s.slice(1):"")+(0>o?"e":"e+")+o;else if(0>o){for(;++o;)s="0"+s;s="0."+s}else if(o>0)if(++o>t)for(o-=t;o--;)s+="0";else t>o&&(s=s.slice(0,o)+"."+s.slice(o));else t>1&&(s=s.charAt(0)+"."+s.slice(1));return e.s<0&&(!u||4==r)?"-"+s:s}var o,s=20,f=1,c=1e6,u=1e6,h=-7,l=21,a="[big.js] ",g=a+"Invalid ",p=g+"decimal places",w=a+"Division by zero",d={},v=void 0,m=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;d.abs=function(){var e=new this.constructor(this);return e.s=1,e},d.cmp=function(e){var r,t=this,n=t.c,i=(e=new t.constructor(e)).c,o=t.s,s=e.s,f=t.e,c=e.e;if(!n[0]||!i[0])return n[0]?o:i[0]?-s:0;if(o!=s)return o;if(r=0>o,f!=c)return f>c^r?1:-1;for(s=(f=n.length)<(c=i.length)?f:c,o=-1;++o<s;)if(n[o]!=i[o])return n[o]>i[o]^r?1:-1;return f==c?0:f>c^r?1:-1},d.div=function(e){var r=this,t=r.constructor,i=r.c,o=(e=new t(e)).c,s=r.s==e.s?1:-1,f=t.DP;if(f!==~~f||0>f||f>c)throw Error(p);if(!o[0])throw Error(w);if(!i[0])return new t(0*s);var u,h,l,a,g,d=o.slice(),m=u=o.length,E=i.length,M=i.slice(0,u),P=M.length,b=e,D=b.c=[],R=0,A=f+(b.e=r.e-e.e)+1;for(b.s=s,s=0>A?0:A,d.unshift(0);P++<u;)M.push(0);do{for(l=0;10>l;l++){if(u!=(P=M.length))a=u>P?1:-1;else for(g=-1,a=0;++g<u;)if(o[g]!=M[g]){a=o[g]>M[g]?1:-1;break}if(!(0>a))break;for(h=P==u?o:d;P;){if(M[--P]<h[P]){for(g=P;g&&!M[--g];)M[g]=9;--M[g],M[P]+=10}M[P]-=h[P]}for(;!M[0];)M.shift()}D[R++]=a?l:++l,M[0]&&a?M[P]=i[m]||0:M=[i[m]]}while((m++<E||M[0]!==v)&&s--);return D[0]||1==R||(D.shift(),b.e--),R>A&&n(b,f,t.RM,M[0]!==v),b},d.eq=function(e){return!this.cmp(e)},d.gt=function(e){return this.cmp(e)>0},d.gte=function(e){return this.cmp(e)>-1},d.lt=function(e){return this.cmp(e)<0},d.lte=function(e){return this.cmp(e)<1},d.minus=d.sub=function(e){var r,t,n,i,o=this,s=o.constructor,f=o.s,c=(e=new s(e)).s;if(f!=c)return e.s=-c,o.plus(e);var u=o.c.slice(),h=o.e,l=e.c,a=e.e;if(!u[0]||!l[0])return l[0]?(e.s=-c,e):new s(u[0]?o:0);if(f=h-a){for((i=0>f)?(f=-f,n=u):(a=h,n=l),n.reverse(),c=f;c--;)n.push(0);n.reverse()}else for(t=((i=u.length<l.length)?u:l).length,f=c=0;t>c;c++)if(u[c]!=l[c]){i=u[c]<l[c];break}if(i&&(n=u,u=l,l=n,e.s=-e.s),(c=(t=l.length)-(r=u.length))>0)for(;c--;)u[r++]=0;for(c=r;t>f;){if(u[--t]<l[t]){for(r=t;r&&!u[--r];)u[r]=9;--u[r],u[t]+=10}u[t]-=l[t]}for(;0===u[--c];)u.pop();for(;0===u[0];)u.shift(),--a;return u[0]||(e.s=1,u=[a=0]),e.c=u,e.e=a,e},d.mod=function(e){var r,t=this,n=t.constructor,i=t.s,o=(e=new n(e)).s;if(!e.c[0])throw Error(w);return t.s=e.s=1,r=1==e.cmp(t),t.s=i,e.s=o,r?new n(t):(i=n.DP,o=n.RM,n.DP=n.RM=0,t=t.div(e),n.DP=i,n.RM=o,this.minus(t.times(e)))},d.plus=d.add=function(e){var r,t=this,n=t.constructor,i=t.s,o=(e=new n(e)).s;if(i!=o)return e.s=-o,t.minus(e);var s=t.e,f=t.c,c=e.e,u=e.c;if(!f[0]||!u[0])return u[0]?e:new n(f[0]?t:0*i);if(f=f.slice(),i=s-c){for(i>0?(c=s,r=u):(i=-i,r=f),r.reverse();i--;)r.push(0);r.reverse()}for(f.length-u.length<0&&(r=u,u=f,f=r),i=u.length,o=0;i;f[i]%=10)o=(f[--i]=f[i]+u[i]+o)/10|0;for(o&&(f.unshift(o),++c),i=f.length;0===f[--i];)f.pop();return e.c=f,e.e=c,e},d.pow=function(e){var r=this,t=new r.constructor(1),n=t,i=0>e;if(e!==~~e||-u>e||e>u)throw Error(g+"exponent");for(i&&(e=-e);1&e&&(n=n.times(r)),e>>=1,e;)r=r.times(r);return i?t.div(n):n},d.round=function(e,r){var t=this.constructor;if(e===v)e=0;else if(e!==~~e||0>e||e>c)throw Error(p);return n(new t(this),e,r===v?t.RM:r)},d.sqrt=function(){var e,r,t,i=this,o=i.constructor,s=i.s,f=i.e,c=new o(.5);if(!i.c[0])return new o(i);if(0>s)throw Error(a+"No square root");s=Math.sqrt(i.toString()),0===s||s===1/0?(r=i.c.join(""),r.length+f&1||(r+="0"),e=new o(Math.sqrt(r).toString()),e.e=((f+1)/2|0)-(0>f||1&f)):e=new o(s.toString()),f=e.e+(o.DP+=4);do t=e,e=c.times(t.plus(i.div(t)));while(t.c.slice(0,f).join("")!==e.c.slice(0,f).join(""));return n(e,o.DP-=4,o.RM)},d.times=d.mul=function(e){var r,t=this,n=t.constructor,i=t.c,o=(e=new n(e)).c,s=i.length,f=o.length,c=t.e,u=e.e;if(e.s=t.s==e.s?1:-1,!i[0]||!o[0])return new n(0*e.s);for(e.e=c+u,f>s&&(r=i,i=o,o=r,u=s,s=f,f=u),r=new Array(u=s+f);u--;)r[u]=0;for(c=f;c--;){for(f=0,u=s+c;u>c;)f=r[u]+o[c]*i[u-c-1]+f,r[u--]=f%10,f=f/10|0;r[u]=(r[u]+f)%10}for(f?++e.e:r.shift(),c=r.length;!r[--c];)r.pop();return e.c=r,e},d.toExponential=function(e){return i(this,1,e,e)},d.toFixed=function(e){return i(this,2,e,this.e+e)},d.toPrecision=function(e){return i(this,3,e,e-1)},d.toString=function(){return i(this)},d.valueOf=d.toJSON=function(){return i(this,4)},o=r(),o["default"]=o.Big=o,"function"==typeof define&&define.amd?define(function(){return o}):"undefined"!=typeof module&&module.exports?module.exports=o:e.Big=o}(this); | ||
//# sourceMappingURL=doc/big.js.map |
{ | ||
"name": "big.js", | ||
"description": "A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic", | ||
"version": "4.0.2", | ||
"version": "5.0.0", | ||
"keywords": [ | ||
@@ -37,8 +37,9 @@ "arbitrary", | ||
"test": "node ./test/every-test.js", | ||
"build": "uglifyjs big.js --source-map doc/big.js.map -c -m -o big.min.js --preamble \"/* big.js v4.0.2 https://github.com/MikeMcl/big.js/LICENCE */\"" | ||
"build": "uglifyjs big.js --source-map doc/big.js.map -c -m -o big.min.js --preamble \"/* big.js v5.0.0 https://github.com/MikeMcl/big.js/LICENCE */\"" | ||
}, | ||
"files": [ | ||
"big.js", | ||
"big.mjs", | ||
"big.min.js" | ||
] | ||
} |
@@ -12,3 +12,3 @@ | ||
- Faster, smaller and easier-to-use than JavaScript versions of Java's BigDecimal | ||
- Only 2.7 KB minified and gzipped | ||
- Only 5.9 KB minified and 2.7 KB gzipped | ||
- Simple API | ||
@@ -72,5 +72,5 @@ - Replicates the `toExponential`, `toFixed` and `toPrecision` methods of JavaScript's Number type | ||
The maximum number of decimal places and the rounding mode used to round the results of the `div`, `sqrt` and `pow` | ||
(with negative exponent) methods is determined by the value of the `DP` and `RM` properties of the `Big` number constructor. | ||
(with negative exponent) methods is determined by the value of the `DP` and `RM` properties of the `Big` number constructor. | ||
The other methods always give the exact result. | ||
The other methods always give the exact result. | ||
@@ -175,4 +175,2 @@ (From *v3.0.0*, multiple Big number constructors can be created, see Change Log below.) | ||
BTC **1DppGRQSjVSMgGxuygDEHQuWEdTiVEzJYG** | ||
## Licence | ||
@@ -184,6 +182,16 @@ | ||
####5.0.0 | ||
* 13/10/17 | ||
* Return `-0` from `valueOf` for negative zero. | ||
* Refactor the methods which return a string. | ||
* Amend error messaging. | ||
* Update API document and change its colour scheme. | ||
* Add `Big.version`. | ||
* Remove bitcoin address. | ||
####4.0.2 | ||
* 28/09/17 | ||
* Add *big.mjs* for use with Node.js with `--experimental-modules` flag. | ||
* Add *big.mjs* for use with Node.js with `--experimental-modules` flag. | ||
@@ -190,0 +198,0 @@ ####4.0.0 |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60773
6
1472
278
1