@bpmn-io/form-js-playground 1.24.0 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form-playground.umd.js +323 -1287
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +4 -4
- package/dist/index.es.js.map +1 -1
- package/package.json +4 -5
|
@@ -75,13 +75,13 @@
|
|
|
75
75
|
i = [],
|
|
76
76
|
r = [],
|
|
77
77
|
o = m$2({}, u);
|
|
78
|
-
o.__v = u.__v + 1, l$2.vnode && l$2.vnode(o), q$3(n.__P, o, u, n.__n, n.__P.namespaceURI, 32 & u.__u ? [t] : null, i, null == t ? $$2(u) : t, !!(32 & u.__u), r), o.__v = u.__v, o.__.__k[o.__i] = o, D$3(i, o, r), u.__e = u.__ = null, o.__e != t && P$
|
|
78
|
+
o.__v = u.__v + 1, l$2.vnode && l$2.vnode(o), q$3(n.__P, o, u, n.__n, n.__P.namespaceURI, 32 & u.__u ? [t] : null, i, null == t ? $$2(u) : t, !!(32 & u.__u), r), o.__v = u.__v, o.__.__k[o.__i] = o, D$3(i, o, r), u.__e = u.__ = null, o.__e != t && P$3(o);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function P$
|
|
81
|
+
function P$3(n) {
|
|
82
82
|
if (null != (n = n.__) && null != n.__c) return n.__e = n.__c.base = null, n.__k.some(function (l) {
|
|
83
83
|
if (null != l && null != l.__e) return n.__e = n.__c.base = l.__e;
|
|
84
|
-
}), P$
|
|
84
|
+
}), P$3(n);
|
|
85
85
|
}
|
|
86
86
|
function A$3(n) {
|
|
87
87
|
(!n.__d && (n.__d = true) && i$2.push(n) && !H$2.__r++ || r$1 != l$2.debounceRendering) && ((r$1 = l$2.debounceRendering) || o$1)(H$2);
|
|
@@ -1901,10 +1901,10 @@
|
|
|
1901
1901
|
};
|
|
1902
1902
|
|
|
1903
1903
|
/*
|
|
1904
|
-
* big.js
|
|
1904
|
+
* big.js v5.2.2
|
|
1905
1905
|
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
1906
|
-
* Copyright (c)
|
|
1907
|
-
* https://github.com/MikeMcl/big.js/LICENCE
|
|
1906
|
+
* Copyright (c) 2018 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
1907
|
+
* https://github.com/MikeMcl/big.js/LICENCE
|
|
1908
1908
|
*/
|
|
1909
1909
|
|
|
1910
1910
|
/************************************** EDITABLE DEFAULTS *****************************************/
|
|
@@ -1915,7 +1915,7 @@
|
|
|
1915
1915
|
* The maximum number of decimal places (DP) of the results of operations involving division:
|
|
1916
1916
|
* div and sqrt, and pow with negative exponents.
|
|
1917
1917
|
*/
|
|
1918
|
-
var DP
|
|
1918
|
+
var DP = 20,
|
|
1919
1919
|
// 0 to MAX_DP
|
|
1920
1920
|
|
|
1921
1921
|
/*
|
|
@@ -1926,15 +1926,15 @@
|
|
|
1926
1926
|
* 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
|
|
1927
1927
|
* 3 Away from zero. (ROUND_UP)
|
|
1928
1928
|
*/
|
|
1929
|
-
RM
|
|
1929
|
+
RM = 1,
|
|
1930
1930
|
// 0, 1, 2 or 3
|
|
1931
1931
|
|
|
1932
1932
|
// The maximum value of DP and Big.DP.
|
|
1933
|
-
MAX_DP
|
|
1933
|
+
MAX_DP = 1E6,
|
|
1934
1934
|
// 0 to 1000000
|
|
1935
1935
|
|
|
1936
1936
|
// The maximum magnitude of the exponent argument to the pow method.
|
|
1937
|
-
MAX_POWER
|
|
1937
|
+
MAX_POWER = 1E6,
|
|
1938
1938
|
// 1 to 1000000
|
|
1939
1939
|
|
|
1940
1940
|
/*
|
|
@@ -1942,42 +1942,36 @@
|
|
|
1942
1942
|
* (JavaScript numbers: -7)
|
|
1943
1943
|
* -1000000 is the minimum recommended exponent value of a Big.
|
|
1944
1944
|
*/
|
|
1945
|
-
NE
|
|
1945
|
+
NE = -7,
|
|
1946
1946
|
// 0 to -1000000
|
|
1947
1947
|
|
|
1948
1948
|
/*
|
|
1949
1949
|
* The positive exponent (PE) at and above which toString returns exponential notation.
|
|
1950
1950
|
* (JavaScript numbers: 21)
|
|
1951
|
-
* 1000000 is the maximum recommended exponent value of a Big
|
|
1951
|
+
* 1000000 is the maximum recommended exponent value of a Big.
|
|
1952
|
+
* (This limit is not enforced or checked.)
|
|
1952
1953
|
*/
|
|
1953
|
-
PE
|
|
1954
|
+
PE = 21,
|
|
1954
1955
|
// 0 to 1000000
|
|
1955
1956
|
|
|
1956
|
-
/*
|
|
1957
|
-
* When true, an error will be thrown if a primitive number is passed to the Big constructor,
|
|
1958
|
-
* or if valueOf is called, or if toNumber is called on a Big which cannot be converted to a
|
|
1959
|
-
* primitive number without a loss of precision.
|
|
1960
|
-
*/
|
|
1961
|
-
STRICT$1 = false,
|
|
1962
|
-
// true or false
|
|
1963
|
-
|
|
1964
1957
|
/**************************************************************************************************/
|
|
1965
1958
|
|
|
1966
1959
|
// Error messages.
|
|
1967
|
-
NAME
|
|
1968
|
-
INVALID$
|
|
1969
|
-
INVALID_DP
|
|
1970
|
-
INVALID_RM
|
|
1971
|
-
DIV_BY_ZERO
|
|
1960
|
+
NAME = '[big.js] ',
|
|
1961
|
+
INVALID$3 = NAME + 'Invalid ',
|
|
1962
|
+
INVALID_DP = INVALID$3 + 'decimal places',
|
|
1963
|
+
INVALID_RM = INVALID$3 + 'rounding mode',
|
|
1964
|
+
DIV_BY_ZERO = NAME + 'Division by zero',
|
|
1972
1965
|
// The shared prototype object.
|
|
1973
|
-
P$
|
|
1974
|
-
UNDEFINED
|
|
1975
|
-
NUMERIC
|
|
1966
|
+
P$2 = {},
|
|
1967
|
+
UNDEFINED = void 0,
|
|
1968
|
+
NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
|
|
1976
1969
|
|
|
1977
1970
|
/*
|
|
1978
1971
|
* Create and return a Big constructor.
|
|
1972
|
+
*
|
|
1979
1973
|
*/
|
|
1980
|
-
function _Big_
|
|
1974
|
+
function _Big_() {
|
|
1981
1975
|
/*
|
|
1982
1976
|
* The Big constructor and exported function.
|
|
1983
1977
|
* Create and return a new instance of a Big number object.
|
|
@@ -1988,9 +1982,7 @@
|
|
|
1988
1982
|
var x = this;
|
|
1989
1983
|
|
|
1990
1984
|
// Enable constructor usage without new.
|
|
1991
|
-
if (!(x instanceof Big))
|
|
1992
|
-
return n === UNDEFINED$1 && arguments.length === 0 ? _Big_$1() : new Big(n);
|
|
1993
|
-
}
|
|
1985
|
+
if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);
|
|
1994
1986
|
|
|
1995
1987
|
// Duplicate.
|
|
1996
1988
|
if (n instanceof Big) {
|
|
@@ -1998,31 +1990,21 @@
|
|
|
1998
1990
|
x.e = n.e;
|
|
1999
1991
|
x.c = n.c.slice();
|
|
2000
1992
|
} else {
|
|
2001
|
-
|
|
2002
|
-
if (Big.strict === true && typeof n !== 'bigint') {
|
|
2003
|
-
throw TypeError(INVALID$4 + 'value');
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
// Minus zero?
|
|
2007
|
-
n = n === 0 && 1 / n < 0 ? '-0' : String(n);
|
|
2008
|
-
}
|
|
2009
|
-
parse$2(x, n);
|
|
1993
|
+
parse$1(x, n);
|
|
2010
1994
|
}
|
|
2011
1995
|
|
|
2012
|
-
|
|
2013
|
-
|
|
1996
|
+
/*
|
|
1997
|
+
* Retain a reference to this Big constructor, and shadow Big.prototype.constructor which
|
|
1998
|
+
* points to Object.
|
|
1999
|
+
*/
|
|
2014
2000
|
x.constructor = Big;
|
|
2015
2001
|
}
|
|
2016
|
-
Big.prototype = P$
|
|
2017
|
-
Big.DP = DP
|
|
2018
|
-
Big.RM = RM
|
|
2019
|
-
Big.NE = NE
|
|
2020
|
-
Big.PE = PE
|
|
2021
|
-
Big.
|
|
2022
|
-
Big.roundDown = 0;
|
|
2023
|
-
Big.roundHalfUp = 1;
|
|
2024
|
-
Big.roundHalfEven = 2;
|
|
2025
|
-
Big.roundUp = 3;
|
|
2002
|
+
Big.prototype = P$2;
|
|
2003
|
+
Big.DP = DP;
|
|
2004
|
+
Big.RM = RM;
|
|
2005
|
+
Big.NE = NE;
|
|
2006
|
+
Big.PE = PE;
|
|
2007
|
+
Big.version = '5.2.2';
|
|
2026
2008
|
return Big;
|
|
2027
2009
|
}
|
|
2028
2010
|
|
|
@@ -2032,11 +2014,11 @@
|
|
|
2032
2014
|
* x {Big} A Big number instance.
|
|
2033
2015
|
* n {number|string} A numeric value.
|
|
2034
2016
|
*/
|
|
2035
|
-
function parse$
|
|
2017
|
+
function parse$1(x, n) {
|
|
2036
2018
|
var e, i, nl;
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2019
|
+
|
|
2020
|
+
// Minus zero?
|
|
2021
|
+
if (n === 0 && 1 / n < 0) n = '-0';else if (!NUMERIC.test(n += '')) throw Error(INVALID$3 + 'number');
|
|
2040
2022
|
|
|
2041
2023
|
// Determine sign.
|
|
2042
2024
|
x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
|
|
@@ -2074,52 +2056,60 @@
|
|
|
2074
2056
|
}
|
|
2075
2057
|
|
|
2076
2058
|
/*
|
|
2077
|
-
* Round Big x to a maximum of
|
|
2059
|
+
* Round Big x to a maximum of dp decimal places using rounding mode rm.
|
|
2060
|
+
* Called by stringify, P.div, P.round and P.sqrt.
|
|
2078
2061
|
*
|
|
2079
2062
|
* x {Big} The Big to round.
|
|
2080
|
-
*
|
|
2081
|
-
* rm {number}
|
|
2063
|
+
* dp {number} Integer, 0 to MAX_DP inclusive.
|
|
2064
|
+
* rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP)
|
|
2082
2065
|
* [more] {boolean} Whether the result of division was truncated.
|
|
2083
2066
|
*/
|
|
2084
|
-
function round
|
|
2085
|
-
var xc = x.c
|
|
2086
|
-
|
|
2087
|
-
if (
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
if (
|
|
2094
|
-
|
|
2095
|
-
x.e = x.e - sd + 1;
|
|
2096
|
-
xc[0] = 1;
|
|
2067
|
+
function round(x, dp, rm, more) {
|
|
2068
|
+
var xc = x.c,
|
|
2069
|
+
i = x.e + dp + 1;
|
|
2070
|
+
if (i < xc.length) {
|
|
2071
|
+
if (rm === 1) {
|
|
2072
|
+
// xc[i] is the digit after the digit that may be rounded up.
|
|
2073
|
+
more = xc[i] >= 5;
|
|
2074
|
+
} else if (rm === 2) {
|
|
2075
|
+
more = xc[i] > 5 || xc[i] == 5 && (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1);
|
|
2076
|
+
} else if (rm === 3) {
|
|
2077
|
+
more = more || !!xc[0];
|
|
2097
2078
|
} else {
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2079
|
+
more = false;
|
|
2080
|
+
if (rm !== 0) throw Error(INVALID_RM);
|
|
2081
|
+
}
|
|
2082
|
+
if (i < 1) {
|
|
2083
|
+
xc.length = 1;
|
|
2084
|
+
if (more) {
|
|
2085
|
+
// 1, 0.1, 0.01, 0.001, 0.0001 etc.
|
|
2086
|
+
x.e = -dp;
|
|
2087
|
+
xc[0] = 1;
|
|
2088
|
+
} else {
|
|
2089
|
+
// Zero.
|
|
2090
|
+
xc[0] = x.e = 0;
|
|
2091
|
+
}
|
|
2092
|
+
} else {
|
|
2093
|
+
// Remove any digits after the required decimal places.
|
|
2094
|
+
xc.length = i--;
|
|
2095
|
+
|
|
2096
|
+
// Round up?
|
|
2097
|
+
if (more) {
|
|
2098
|
+
// Rounding up may mean the previous digit has to be rounded up.
|
|
2099
|
+
for (; ++xc[i] > 9;) {
|
|
2100
|
+
xc[i] = 0;
|
|
2101
|
+
if (!i--) {
|
|
2102
|
+
++x.e;
|
|
2103
|
+
xc.unshift(1);
|
|
2104
|
+
}
|
|
2117
2105
|
}
|
|
2118
2106
|
}
|
|
2119
|
-
}
|
|
2120
2107
|
|
|
2121
|
-
|
|
2122
|
-
|
|
2108
|
+
// Remove trailing zeros.
|
|
2109
|
+
for (i = xc.length; !xc[--i];) xc.pop();
|
|
2110
|
+
}
|
|
2111
|
+
} else if (rm < 0 || rm > 3 || rm !== ~~rm) {
|
|
2112
|
+
throw Error(INVALID_RM);
|
|
2123
2113
|
}
|
|
2124
2114
|
return x;
|
|
2125
2115
|
}
|
|
@@ -2127,14 +2117,45 @@
|
|
|
2127
2117
|
/*
|
|
2128
2118
|
* Return a string representing the value of Big x in normal or exponential notation.
|
|
2129
2119
|
* Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2120
|
+
*
|
|
2121
|
+
* x {Big}
|
|
2122
|
+
* id? {number} Caller id.
|
|
2123
|
+
* 1 toExponential
|
|
2124
|
+
* 2 toFixed
|
|
2125
|
+
* 3 toPrecision
|
|
2126
|
+
* 4 valueOf
|
|
2127
|
+
* n? {number|undefined} Caller's argument.
|
|
2128
|
+
* k? {number|undefined}
|
|
2129
|
+
*/
|
|
2130
|
+
function stringify(x, id, n, k) {
|
|
2131
|
+
var e,
|
|
2132
|
+
s,
|
|
2133
|
+
Big = x.constructor,
|
|
2134
|
+
z = !x.c[0];
|
|
2135
|
+
if (n !== UNDEFINED) {
|
|
2136
|
+
if (n !== ~~n || n < (id == 3) || n > MAX_DP) {
|
|
2137
|
+
throw Error(id == 3 ? INVALID$3 + 'precision' : INVALID_DP);
|
|
2138
|
+
}
|
|
2139
|
+
x = new Big(x);
|
|
2140
|
+
|
|
2141
|
+
// The index of the digit that may be rounded up.
|
|
2142
|
+
n = k - x.e;
|
|
2143
|
+
|
|
2144
|
+
// Round?
|
|
2145
|
+
if (x.c.length > ++k) round(x, n, Big.RM);
|
|
2146
|
+
|
|
2147
|
+
// toFixed: recalculate k as x.e may have changed if value rounded up.
|
|
2148
|
+
if (id == 2) k = x.e + n + 1;
|
|
2149
|
+
|
|
2150
|
+
// Append zeros?
|
|
2151
|
+
for (; x.c.length < k;) x.c.push(0);
|
|
2152
|
+
}
|
|
2153
|
+
e = x.e;
|
|
2154
|
+
s = x.c.join('');
|
|
2155
|
+
n = s.length;
|
|
2135
2156
|
|
|
2136
2157
|
// Exponential notation?
|
|
2137
|
-
if (
|
|
2158
|
+
if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) {
|
|
2138
2159
|
s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
|
|
2139
2160
|
|
|
2140
2161
|
// Normal notation.
|
|
@@ -2142,15 +2163,11 @@
|
|
|
2142
2163
|
for (; ++e;) s = '0' + s;
|
|
2143
2164
|
s = '0.' + s;
|
|
2144
2165
|
} else if (e > 0) {
|
|
2145
|
-
if (++e > n)
|
|
2146
|
-
for (e -= n; e--;) s += '0';
|
|
2147
|
-
} else if (e < n) {
|
|
2148
|
-
s = s.slice(0, e) + '.' + s.slice(e);
|
|
2149
|
-
}
|
|
2166
|
+
if (++e > n) for (e -= n; e--;) s += '0';else if (e < n) s = s.slice(0, e) + '.' + s.slice(e);
|
|
2150
2167
|
} else if (n > 1) {
|
|
2151
2168
|
s = s.charAt(0) + '.' + s.slice(1);
|
|
2152
2169
|
}
|
|
2153
|
-
return x.s < 0 &&
|
|
2170
|
+
return x.s < 0 && (!z || id == 4) ? '-' + s : s;
|
|
2154
2171
|
}
|
|
2155
2172
|
|
|
2156
2173
|
// Prototype/instance methods
|
|
@@ -2158,7 +2175,7 @@
|
|
|
2158
2175
|
/*
|
|
2159
2176
|
* Return a new Big whose value is the absolute value of this Big.
|
|
2160
2177
|
*/
|
|
2161
|
-
P$
|
|
2178
|
+
P$2.abs = function () {
|
|
2162
2179
|
var x = new this.constructor(this);
|
|
2163
2180
|
x.s = 1;
|
|
2164
2181
|
return x;
|
|
@@ -2168,8 +2185,8 @@
|
|
|
2168
2185
|
* Return 1 if the value of this Big is greater than the value of Big y,
|
|
2169
2186
|
* -1 if the value of this Big is less than the value of Big y, or
|
|
2170
2187
|
* 0 if they have the same value.
|
|
2171
|
-
|
|
2172
|
-
P$
|
|
2188
|
+
*/
|
|
2189
|
+
P$2.cmp = function (y) {
|
|
2173
2190
|
var isneg,
|
|
2174
2191
|
x = this,
|
|
2175
2192
|
xc = x.c,
|
|
@@ -2203,7 +2220,7 @@
|
|
|
2203
2220
|
* Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
|
|
2204
2221
|
* if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
2205
2222
|
*/
|
|
2206
|
-
P$
|
|
2223
|
+
P$2.div = function (y) {
|
|
2207
2224
|
var x = this,
|
|
2208
2225
|
Big = x.constructor,
|
|
2209
2226
|
a = x.c,
|
|
@@ -2212,21 +2229,13 @@
|
|
|
2212
2229
|
// divisor
|
|
2213
2230
|
k = x.s == y.s ? 1 : -1,
|
|
2214
2231
|
dp = Big.DP;
|
|
2215
|
-
if (dp !== ~~dp || dp < 0 || dp > MAX_DP
|
|
2216
|
-
throw Error(INVALID_DP$1);
|
|
2217
|
-
}
|
|
2232
|
+
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP);
|
|
2218
2233
|
|
|
2219
2234
|
// Divisor is zero?
|
|
2220
|
-
if (!b[0])
|
|
2221
|
-
throw Error(DIV_BY_ZERO$1);
|
|
2222
|
-
}
|
|
2235
|
+
if (!b[0]) throw Error(DIV_BY_ZERO);
|
|
2223
2236
|
|
|
2224
2237
|
// Dividend is 0? Return +-0.
|
|
2225
|
-
if (!a[0])
|
|
2226
|
-
y.s = k;
|
|
2227
|
-
y.c = [y.e = 0];
|
|
2228
|
-
return y;
|
|
2229
|
-
}
|
|
2238
|
+
if (!a[0]) return new Big(k * 0);
|
|
2230
2239
|
var bl,
|
|
2231
2240
|
bt,
|
|
2232
2241
|
n,
|
|
@@ -2242,10 +2251,10 @@
|
|
|
2242
2251
|
// quotient
|
|
2243
2252
|
qc = q.c = [],
|
|
2244
2253
|
qi = 0,
|
|
2245
|
-
|
|
2254
|
+
d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result
|
|
2246
2255
|
|
|
2247
2256
|
q.s = k;
|
|
2248
|
-
k =
|
|
2257
|
+
k = d < 0 ? 0 : d;
|
|
2249
2258
|
|
|
2250
2259
|
// Create version of divisor with leading zero.
|
|
2251
2260
|
bz.unshift(0);
|
|
@@ -2291,33 +2300,32 @@
|
|
|
2291
2300
|
|
|
2292
2301
|
// Update the remainder.
|
|
2293
2302
|
if (r[0] && cmp) r[rl] = a[ai] || 0;else r = [a[ai]];
|
|
2294
|
-
} while ((ai++ < al || r[0] !== UNDEFINED
|
|
2303
|
+
} while ((ai++ < al || r[0] !== UNDEFINED) && k--);
|
|
2295
2304
|
|
|
2296
2305
|
// Leading zero? Do not remove if result is simply zero (qi == 1).
|
|
2297
2306
|
if (!qc[0] && qi != 1) {
|
|
2298
2307
|
// There can't be more than one zero.
|
|
2299
2308
|
qc.shift();
|
|
2300
2309
|
q.e--;
|
|
2301
|
-
p--;
|
|
2302
2310
|
}
|
|
2303
2311
|
|
|
2304
2312
|
// Round?
|
|
2305
|
-
if (qi >
|
|
2313
|
+
if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED);
|
|
2306
2314
|
return q;
|
|
2307
2315
|
};
|
|
2308
2316
|
|
|
2309
2317
|
/*
|
|
2310
2318
|
* Return true if the value of this Big is equal to the value of Big y, otherwise return false.
|
|
2311
2319
|
*/
|
|
2312
|
-
P$
|
|
2313
|
-
return this.cmp(y)
|
|
2320
|
+
P$2.eq = function (y) {
|
|
2321
|
+
return !this.cmp(y);
|
|
2314
2322
|
};
|
|
2315
2323
|
|
|
2316
2324
|
/*
|
|
2317
2325
|
* Return true if the value of this Big is greater than the value of Big y, otherwise return
|
|
2318
2326
|
* false.
|
|
2319
2327
|
*/
|
|
2320
|
-
P$
|
|
2328
|
+
P$2.gt = function (y) {
|
|
2321
2329
|
return this.cmp(y) > 0;
|
|
2322
2330
|
};
|
|
2323
2331
|
|
|
@@ -2325,14 +2333,14 @@
|
|
|
2325
2333
|
* Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
|
|
2326
2334
|
* return false.
|
|
2327
2335
|
*/
|
|
2328
|
-
P$
|
|
2336
|
+
P$2.gte = function (y) {
|
|
2329
2337
|
return this.cmp(y) > -1;
|
|
2330
2338
|
};
|
|
2331
2339
|
|
|
2332
2340
|
/*
|
|
2333
2341
|
* Return true if the value of this Big is less than the value of Big y, otherwise return false.
|
|
2334
2342
|
*/
|
|
2335
|
-
P$
|
|
2343
|
+
P$2.lt = function (y) {
|
|
2336
2344
|
return this.cmp(y) < 0;
|
|
2337
2345
|
};
|
|
2338
2346
|
|
|
@@ -2340,14 +2348,14 @@
|
|
|
2340
2348
|
* Return true if the value of this Big is less than or equal to the value of Big y, otherwise
|
|
2341
2349
|
* return false.
|
|
2342
2350
|
*/
|
|
2343
|
-
P$
|
|
2351
|
+
P$2.lte = function (y) {
|
|
2344
2352
|
return this.cmp(y) < 1;
|
|
2345
2353
|
};
|
|
2346
2354
|
|
|
2347
2355
|
/*
|
|
2348
2356
|
* Return a new Big whose value is the value of this Big minus the value of Big y.
|
|
2349
2357
|
*/
|
|
2350
|
-
P$
|
|
2358
|
+
P$2.minus = P$2.sub = function (y) {
|
|
2351
2359
|
var i,
|
|
2352
2360
|
j,
|
|
2353
2361
|
t,
|
|
@@ -2369,14 +2377,8 @@
|
|
|
2369
2377
|
|
|
2370
2378
|
// Either zero?
|
|
2371
2379
|
if (!xc[0] || !yc[0]) {
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
} else if (xc[0]) {
|
|
2375
|
-
y = new Big(x);
|
|
2376
|
-
} else {
|
|
2377
|
-
y.s = 1;
|
|
2378
|
-
}
|
|
2379
|
-
return y;
|
|
2380
|
+
// y is non-zero? x is non-zero? Or both are zero.
|
|
2381
|
+
return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0);
|
|
2380
2382
|
}
|
|
2381
2383
|
|
|
2382
2384
|
// Determine which is the bigger number. Prepend zeros to equalise exponents.
|
|
@@ -2449,15 +2451,13 @@
|
|
|
2449
2451
|
/*
|
|
2450
2452
|
* Return a new Big whose value is the value of this Big modulo the value of Big y.
|
|
2451
2453
|
*/
|
|
2452
|
-
P$
|
|
2454
|
+
P$2.mod = function (y) {
|
|
2453
2455
|
var ygtx,
|
|
2454
2456
|
x = this,
|
|
2455
2457
|
Big = x.constructor,
|
|
2456
2458
|
a = x.s,
|
|
2457
2459
|
b = (y = new Big(y)).s;
|
|
2458
|
-
if (!y.c[0])
|
|
2459
|
-
throw Error(DIV_BY_ZERO$1);
|
|
2460
|
-
}
|
|
2460
|
+
if (!y.c[0]) throw Error(DIV_BY_ZERO);
|
|
2461
2461
|
x.s = y.s = 1;
|
|
2462
2462
|
ygtx = y.cmp(x) == 1;
|
|
2463
2463
|
x.s = a;
|
|
@@ -2472,29 +2472,19 @@
|
|
|
2472
2472
|
return this.minus(x.times(y));
|
|
2473
2473
|
};
|
|
2474
2474
|
|
|
2475
|
-
/*
|
|
2476
|
-
* Return a new Big whose value is the value of this Big negated.
|
|
2477
|
-
*/
|
|
2478
|
-
P$3.neg = function () {
|
|
2479
|
-
var x = new this.constructor(this);
|
|
2480
|
-
x.s = -x.s;
|
|
2481
|
-
return x;
|
|
2482
|
-
};
|
|
2483
|
-
|
|
2484
2475
|
/*
|
|
2485
2476
|
* Return a new Big whose value is the value of this Big plus the value of Big y.
|
|
2486
2477
|
*/
|
|
2487
|
-
P$
|
|
2488
|
-
var
|
|
2489
|
-
k,
|
|
2490
|
-
t,
|
|
2478
|
+
P$2.plus = P$2.add = function (y) {
|
|
2479
|
+
var t,
|
|
2491
2480
|
x = this,
|
|
2492
|
-
Big = x.constructor
|
|
2493
|
-
|
|
2481
|
+
Big = x.constructor,
|
|
2482
|
+
a = x.s,
|
|
2483
|
+
b = (y = new Big(y)).s;
|
|
2494
2484
|
|
|
2495
2485
|
// Signs differ?
|
|
2496
|
-
if (
|
|
2497
|
-
y.s = -
|
|
2486
|
+
if (a != b) {
|
|
2487
|
+
y.s = -b;
|
|
2498
2488
|
return x.minus(y);
|
|
2499
2489
|
}
|
|
2500
2490
|
var xe = x.e,
|
|
@@ -2502,31 +2492,22 @@
|
|
|
2502
2492
|
ye = y.e,
|
|
2503
2493
|
yc = y.c;
|
|
2504
2494
|
|
|
2505
|
-
// Either zero?
|
|
2506
|
-
if (!xc[0] || !yc[0])
|
|
2507
|
-
if (!yc[0]) {
|
|
2508
|
-
if (xc[0]) {
|
|
2509
|
-
y = new Big(x);
|
|
2510
|
-
} else {
|
|
2511
|
-
y.s = x.s;
|
|
2512
|
-
}
|
|
2513
|
-
}
|
|
2514
|
-
return y;
|
|
2515
|
-
}
|
|
2495
|
+
// Either zero? y is non-zero? x is non-zero? Or both are zero.
|
|
2496
|
+
if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0);
|
|
2516
2497
|
xc = xc.slice();
|
|
2517
2498
|
|
|
2518
2499
|
// Prepend zeros to equalise exponents.
|
|
2519
2500
|
// Note: reverse faster than unshifts.
|
|
2520
|
-
if (
|
|
2521
|
-
if (
|
|
2501
|
+
if (a = xe - ye) {
|
|
2502
|
+
if (a > 0) {
|
|
2522
2503
|
ye = xe;
|
|
2523
2504
|
t = yc;
|
|
2524
2505
|
} else {
|
|
2525
|
-
|
|
2506
|
+
a = -a;
|
|
2526
2507
|
t = xc;
|
|
2527
2508
|
}
|
|
2528
2509
|
t.reverse();
|
|
2529
|
-
for (;
|
|
2510
|
+
for (; a--;) t.push(0);
|
|
2530
2511
|
t.reverse();
|
|
2531
2512
|
}
|
|
2532
2513
|
|
|
@@ -2536,20 +2517,20 @@
|
|
|
2536
2517
|
yc = xc;
|
|
2537
2518
|
xc = t;
|
|
2538
2519
|
}
|
|
2539
|
-
|
|
2520
|
+
a = yc.length;
|
|
2540
2521
|
|
|
2541
2522
|
// Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
|
|
2542
|
-
for (
|
|
2523
|
+
for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0;
|
|
2543
2524
|
|
|
2544
2525
|
// No need to check for zero, as +x + +y != 0 && -x + -y != 0
|
|
2545
2526
|
|
|
2546
|
-
if (
|
|
2547
|
-
xc.unshift(
|
|
2527
|
+
if (b) {
|
|
2528
|
+
xc.unshift(b);
|
|
2548
2529
|
++ye;
|
|
2549
2530
|
}
|
|
2550
2531
|
|
|
2551
2532
|
// Remove trailing zeros.
|
|
2552
|
-
for (
|
|
2533
|
+
for (a = xc.length; xc[--a] === 0;) xc.pop();
|
|
2553
2534
|
y.c = xc;
|
|
2554
2535
|
y.e = ye;
|
|
2555
2536
|
return y;
|
|
@@ -2562,14 +2543,12 @@
|
|
|
2562
2543
|
*
|
|
2563
2544
|
* n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
|
|
2564
2545
|
*/
|
|
2565
|
-
P$
|
|
2546
|
+
P$2.pow = function (n) {
|
|
2566
2547
|
var x = this,
|
|
2567
|
-
one = new x.constructor(
|
|
2548
|
+
one = new x.constructor(1),
|
|
2568
2549
|
y = one,
|
|
2569
2550
|
isneg = n < 0;
|
|
2570
|
-
if (n !== ~~n || n < -MAX_POWER
|
|
2571
|
-
throw Error(INVALID$4 + 'exponent');
|
|
2572
|
-
}
|
|
2551
|
+
if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID$3 + 'exponent');
|
|
2573
2552
|
if (isneg) n = -n;
|
|
2574
2553
|
for (;;) {
|
|
2575
2554
|
if (n & 1) y = y.times(x);
|
|
@@ -2581,40 +2560,26 @@
|
|
|
2581
2560
|
};
|
|
2582
2561
|
|
|
2583
2562
|
/*
|
|
2584
|
-
* Return a new Big whose value is the value of this Big rounded
|
|
2585
|
-
*
|
|
2586
|
-
*
|
|
2587
|
-
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
2588
|
-
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
2589
|
-
*/
|
|
2590
|
-
P$3.prec = function (sd, rm) {
|
|
2591
|
-
if (sd !== ~~sd || sd < 1 || sd > MAX_DP$1) {
|
|
2592
|
-
throw Error(INVALID$4 + 'precision');
|
|
2593
|
-
}
|
|
2594
|
-
return round$1(new this.constructor(this), sd, rm);
|
|
2595
|
-
};
|
|
2596
|
-
|
|
2597
|
-
/*
|
|
2598
|
-
* Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
|
|
2599
|
-
* using rounding mode rm, or Big.RM if rm is not specified.
|
|
2600
|
-
* If dp is negative, round to an integer which is a multiple of 10**-dp.
|
|
2563
|
+
* Return a new Big whose value is the value of this Big rounded using rounding mode rm
|
|
2564
|
+
* to a maximum of dp decimal places, or, if dp is negative, to an integer which is a
|
|
2565
|
+
* multiple of 10**-dp.
|
|
2601
2566
|
* If dp is not specified, round to 0 decimal places.
|
|
2567
|
+
* If rm is not specified, use Big.RM.
|
|
2602
2568
|
*
|
|
2603
2569
|
* dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
|
|
2604
|
-
* rm?
|
|
2570
|
+
* rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP)
|
|
2605
2571
|
*/
|
|
2606
|
-
P$
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
return round$1(new this.constructor(this), dp + this.e + 1, rm);
|
|
2572
|
+
P$2.round = function (dp, rm) {
|
|
2573
|
+
var Big = this.constructor;
|
|
2574
|
+
if (dp === UNDEFINED) dp = 0;else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP);
|
|
2575
|
+
return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm);
|
|
2611
2576
|
};
|
|
2612
2577
|
|
|
2613
2578
|
/*
|
|
2614
2579
|
* Return a new Big whose value is the square root of the value of this Big, rounded, if
|
|
2615
2580
|
* necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
2616
2581
|
*/
|
|
2617
|
-
P$
|
|
2582
|
+
P$2.sqrt = function () {
|
|
2618
2583
|
var r,
|
|
2619
2584
|
c,
|
|
2620
2585
|
t,
|
|
@@ -2622,18 +2587,16 @@
|
|
|
2622
2587
|
Big = x.constructor,
|
|
2623
2588
|
s = x.s,
|
|
2624
2589
|
e = x.e,
|
|
2625
|
-
half = new Big(
|
|
2590
|
+
half = new Big(0.5);
|
|
2626
2591
|
|
|
2627
2592
|
// Zero?
|
|
2628
2593
|
if (!x.c[0]) return new Big(x);
|
|
2629
2594
|
|
|
2630
2595
|
// Negative?
|
|
2631
|
-
if (s < 0)
|
|
2632
|
-
throw Error(NAME$1 + 'No square root');
|
|
2633
|
-
}
|
|
2596
|
+
if (s < 0) throw Error(NAME + 'No square root');
|
|
2634
2597
|
|
|
2635
2598
|
// Estimate.
|
|
2636
|
-
s = Math.sqrt(
|
|
2599
|
+
s = Math.sqrt(x + '');
|
|
2637
2600
|
|
|
2638
2601
|
// Math.sqrt underflow/overflow?
|
|
2639
2602
|
// Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
|
|
@@ -2642,9 +2605,9 @@
|
|
|
2642
2605
|
if (!(c.length + e & 1)) c += '0';
|
|
2643
2606
|
s = Math.sqrt(c);
|
|
2644
2607
|
e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
|
|
2645
|
-
r = new Big((s == 1 / 0 ? '
|
|
2608
|
+
r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
|
|
2646
2609
|
} else {
|
|
2647
|
-
r = new Big(s
|
|
2610
|
+
r = new Big(s);
|
|
2648
2611
|
}
|
|
2649
2612
|
e = r.e + (Big.DP += 4);
|
|
2650
2613
|
|
|
@@ -2653,13 +2616,13 @@
|
|
|
2653
2616
|
t = r;
|
|
2654
2617
|
r = half.times(t.plus(x.div(t)));
|
|
2655
2618
|
} while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
|
|
2656
|
-
return round
|
|
2619
|
+
return round(r, Big.DP -= 4, Big.RM);
|
|
2657
2620
|
};
|
|
2658
2621
|
|
|
2659
2622
|
/*
|
|
2660
2623
|
* Return a new Big whose value is the value of this Big times the value of Big y.
|
|
2661
2624
|
*/
|
|
2662
|
-
P$
|
|
2625
|
+
P$2.times = P$2.mul = function (y) {
|
|
2663
2626
|
var c,
|
|
2664
2627
|
x = this,
|
|
2665
2628
|
Big = x.constructor,
|
|
@@ -2674,10 +2637,7 @@
|
|
|
2674
2637
|
y.s = x.s == y.s ? 1 : -1;
|
|
2675
2638
|
|
|
2676
2639
|
// Return signed 0 if either 0.
|
|
2677
|
-
if (!xc[0] || !yc[0])
|
|
2678
|
-
y.c = [y.e = 0];
|
|
2679
|
-
return y;
|
|
2680
|
-
}
|
|
2640
|
+
if (!xc[0] || !yc[0]) return new Big(y.s * 0);
|
|
2681
2641
|
|
|
2682
2642
|
// Initialise exponent of result as x.e + y.e.
|
|
2683
2643
|
y.e = i + j;
|
|
@@ -2710,7 +2670,7 @@
|
|
|
2710
2670
|
// carry
|
|
2711
2671
|
b = b / 10 | 0;
|
|
2712
2672
|
}
|
|
2713
|
-
c[j] = b;
|
|
2673
|
+
c[j] = (c[j] + b) % 10;
|
|
2714
2674
|
}
|
|
2715
2675
|
|
|
2716
2676
|
// Increment result exponent if there is a final carry, otherwise remove leading zero.
|
|
@@ -2723,48 +2683,37 @@
|
|
|
2723
2683
|
};
|
|
2724
2684
|
|
|
2725
2685
|
/*
|
|
2726
|
-
* Return a string representing the value of this Big in exponential notation
|
|
2727
|
-
*
|
|
2686
|
+
* Return a string representing the value of this Big in exponential notation to dp fixed decimal
|
|
2687
|
+
* places and rounded using Big.RM.
|
|
2728
2688
|
*
|
|
2729
|
-
* dp? {number}
|
|
2730
|
-
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
2689
|
+
* dp? {number} Integer, 0 to MAX_DP inclusive.
|
|
2731
2690
|
*/
|
|
2732
|
-
P$
|
|
2733
|
-
|
|
2734
|
-
n = x.c[0];
|
|
2735
|
-
if (dp !== UNDEFINED$1) {
|
|
2736
|
-
if (dp !== ~~dp || dp < 0 || dp > MAX_DP$1) {
|
|
2737
|
-
throw Error(INVALID_DP$1);
|
|
2738
|
-
}
|
|
2739
|
-
x = round$1(new x.constructor(x), ++dp, rm);
|
|
2740
|
-
for (; x.c.length < dp;) x.c.push(0);
|
|
2741
|
-
}
|
|
2742
|
-
return stringify$1(x, true, !!n);
|
|
2691
|
+
P$2.toExponential = function (dp) {
|
|
2692
|
+
return stringify(this, 1, dp, dp);
|
|
2743
2693
|
};
|
|
2744
2694
|
|
|
2745
2695
|
/*
|
|
2746
|
-
* Return a string representing the value of this Big in normal notation
|
|
2747
|
-
*
|
|
2696
|
+
* Return a string representing the value of this Big in normal notation to dp fixed decimal
|
|
2697
|
+
* places and rounded using Big.RM.
|
|
2748
2698
|
*
|
|
2749
|
-
* dp? {number}
|
|
2750
|
-
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
2699
|
+
* dp? {number} Integer, 0 to MAX_DP inclusive.
|
|
2751
2700
|
*
|
|
2752
2701
|
* (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
|
|
2753
2702
|
* (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
|
|
2754
2703
|
*/
|
|
2755
|
-
P$
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
if (dp !== UNDEFINED$1) {
|
|
2759
|
-
if (dp !== ~~dp || dp < 0 || dp > MAX_DP$1) {
|
|
2760
|
-
throw Error(INVALID_DP$1);
|
|
2761
|
-
}
|
|
2762
|
-
x = round$1(new x.constructor(x), dp + x.e + 1, rm);
|
|
2704
|
+
P$2.toFixed = function (dp) {
|
|
2705
|
+
return stringify(this, 2, dp, this.e + dp);
|
|
2706
|
+
};
|
|
2763
2707
|
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2708
|
+
/*
|
|
2709
|
+
* Return a string representing the value of this Big rounded to sd significant digits using
|
|
2710
|
+
* Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent
|
|
2711
|
+
* the integer part of the value in normal notation.
|
|
2712
|
+
*
|
|
2713
|
+
* sd {number} Integer, 1 to MAX_DP inclusive.
|
|
2714
|
+
*/
|
|
2715
|
+
P$2.toPrecision = function (sd) {
|
|
2716
|
+
return stringify(this, 3, sd, sd - 1);
|
|
2768
2717
|
};
|
|
2769
2718
|
|
|
2770
2719
|
/*
|
|
@@ -2773,47 +2722,8 @@
|
|
|
2773
2722
|
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
2774
2723
|
* Omit the sign for negative zero.
|
|
2775
2724
|
*/
|
|
2776
|
-
P$
|
|
2777
|
-
|
|
2778
|
-
Big = x.constructor;
|
|
2779
|
-
return stringify$1(x, x.e <= Big.NE || x.e >= Big.PE, !!x.c[0]);
|
|
2780
|
-
};
|
|
2781
|
-
if (typeof Symbol !== "undefined") {
|
|
2782
|
-
P$3[Symbol.for('nodejs.util.inspect.custom')] = P$3.toJSON;
|
|
2783
|
-
}
|
|
2784
|
-
|
|
2785
|
-
/*
|
|
2786
|
-
* Return the value of this Big as a primitive number.
|
|
2787
|
-
*/
|
|
2788
|
-
P$3.toNumber = function () {
|
|
2789
|
-
var n = +stringify$1(this, true, true);
|
|
2790
|
-
if (this.constructor.strict === true && !this.eq(n.toString())) {
|
|
2791
|
-
throw Error(NAME$1 + 'Imprecise conversion');
|
|
2792
|
-
}
|
|
2793
|
-
return n;
|
|
2794
|
-
};
|
|
2795
|
-
|
|
2796
|
-
/*
|
|
2797
|
-
* Return a string representing the value of this Big rounded to sd significant digits using
|
|
2798
|
-
* rounding mode rm, or Big.RM if rm is not specified.
|
|
2799
|
-
* Use exponential notation if sd is less than the number of digits necessary to represent
|
|
2800
|
-
* the integer part of the value in normal notation.
|
|
2801
|
-
*
|
|
2802
|
-
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
2803
|
-
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
2804
|
-
*/
|
|
2805
|
-
P$3.toPrecision = function (sd, rm) {
|
|
2806
|
-
var x = this,
|
|
2807
|
-
Big = x.constructor,
|
|
2808
|
-
n = x.c[0];
|
|
2809
|
-
if (sd !== UNDEFINED$1) {
|
|
2810
|
-
if (sd !== ~~sd || sd < 1 || sd > MAX_DP$1) {
|
|
2811
|
-
throw Error(INVALID$4 + 'precision');
|
|
2812
|
-
}
|
|
2813
|
-
x = round$1(new Big(x), sd, rm);
|
|
2814
|
-
for (; x.c.length < sd;) x.c.push(0);
|
|
2815
|
-
}
|
|
2816
|
-
return stringify$1(x, sd <= x.e || x.e <= Big.NE || x.e >= Big.PE, !!n);
|
|
2725
|
+
P$2.toString = function () {
|
|
2726
|
+
return stringify(this);
|
|
2817
2727
|
};
|
|
2818
2728
|
|
|
2819
2729
|
/*
|
|
@@ -2822,18 +2732,13 @@
|
|
|
2822
2732
|
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
2823
2733
|
* Include the sign for negative zero.
|
|
2824
2734
|
*/
|
|
2825
|
-
P$
|
|
2826
|
-
|
|
2827
|
-
Big = x.constructor;
|
|
2828
|
-
if (Big.strict === true) {
|
|
2829
|
-
throw Error(NAME$1 + 'valueOf disallowed');
|
|
2830
|
-
}
|
|
2831
|
-
return stringify$1(x, x.e <= Big.NE || x.e >= Big.PE, true);
|
|
2735
|
+
P$2.valueOf = P$2.toJSON = function () {
|
|
2736
|
+
return stringify(this, 4);
|
|
2832
2737
|
};
|
|
2833
2738
|
|
|
2834
2739
|
// Export
|
|
2835
2740
|
|
|
2836
|
-
var Big
|
|
2741
|
+
var Big = _Big_();
|
|
2837
2742
|
|
|
2838
2743
|
var f = 0;
|
|
2839
2744
|
function u(e, t, n, o, i, u) {
|
|
@@ -8503,7 +8408,7 @@
|
|
|
8503
8408
|
}, zone || mergedZone, next];
|
|
8504
8409
|
}, [{}, null, 1]).slice(0, 2);
|
|
8505
8410
|
}
|
|
8506
|
-
function parse
|
|
8411
|
+
function parse(s, ...patterns) {
|
|
8507
8412
|
if (s == null) {
|
|
8508
8413
|
return [null, null];
|
|
8509
8414
|
}
|
|
@@ -8674,26 +8579,26 @@
|
|
|
8674
8579
|
*/
|
|
8675
8580
|
|
|
8676
8581
|
function parseISODate(s) {
|
|
8677
|
-
return parse
|
|
8582
|
+
return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]);
|
|
8678
8583
|
}
|
|
8679
8584
|
function parseRFC2822Date(s) {
|
|
8680
|
-
return parse
|
|
8585
|
+
return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]);
|
|
8681
8586
|
}
|
|
8682
8587
|
function parseHTTPDate(s) {
|
|
8683
|
-
return parse
|
|
8588
|
+
return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]);
|
|
8684
8589
|
}
|
|
8685
8590
|
function parseISODuration(s) {
|
|
8686
|
-
return parse
|
|
8591
|
+
return parse(s, [isoDuration, extractISODuration]);
|
|
8687
8592
|
}
|
|
8688
8593
|
const extractISOTimeOnly = combineExtractors(extractISOTime);
|
|
8689
8594
|
function parseISOTimeOnly(s) {
|
|
8690
|
-
return parse
|
|
8595
|
+
return parse(s, [isoTimeOnly, extractISOTimeOnly]);
|
|
8691
8596
|
}
|
|
8692
8597
|
const sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
|
|
8693
8598
|
const sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
|
|
8694
8599
|
const extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone);
|
|
8695
8600
|
function parseSQL(s) {
|
|
8696
|
-
return parse
|
|
8601
|
+
return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]);
|
|
8697
8602
|
}
|
|
8698
8603
|
const INVALID$2 = "Invalid Duration";
|
|
8699
8604
|
|
|
@@ -11093,7 +10998,7 @@
|
|
|
11093
10998
|
const resolvedOpts = df.resolvedOptions();
|
|
11094
10999
|
return parts.map(p => tokenForPart(p, formatOpts, resolvedOpts));
|
|
11095
11000
|
}
|
|
11096
|
-
const INVALID
|
|
11001
|
+
const INVALID = "Invalid DateTime";
|
|
11097
11002
|
const MAX_DATE = 8.64e15;
|
|
11098
11003
|
function unsupportedZone(zone) {
|
|
11099
11004
|
return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`);
|
|
@@ -12805,7 +12710,7 @@
|
|
|
12805
12710
|
* @return {string}
|
|
12806
12711
|
*/
|
|
12807
12712
|
toFormat(fmt, opts = {}) {
|
|
12808
|
-
return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID
|
|
12713
|
+
return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID;
|
|
12809
12714
|
}
|
|
12810
12715
|
|
|
12811
12716
|
/**
|
|
@@ -12828,7 +12733,7 @@
|
|
|
12828
12733
|
* @return {string}
|
|
12829
12734
|
*/
|
|
12830
12735
|
toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
|
|
12831
|
-
return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID
|
|
12736
|
+
return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID;
|
|
12832
12737
|
}
|
|
12833
12738
|
|
|
12834
12739
|
/**
|
|
@@ -13036,7 +12941,7 @@
|
|
|
13036
12941
|
* @return {string}
|
|
13037
12942
|
*/
|
|
13038
12943
|
toString() {
|
|
13039
|
-
return this.isValid ? this.toISO() : INVALID
|
|
12944
|
+
return this.isValid ? this.toISO() : INVALID;
|
|
13040
12945
|
}
|
|
13041
12946
|
|
|
13042
12947
|
/**
|
|
@@ -15764,7 +15669,7 @@
|
|
|
15764
15669
|
return W$1(n, t, e);
|
|
15765
15670
|
}), n.__c && n.__c.__P === t && (n.__e && e.appendChild(n.__e), n.__c.__e = true, n.__c.__P = e)), n;
|
|
15766
15671
|
}
|
|
15767
|
-
function P$
|
|
15672
|
+
function P$1() {
|
|
15768
15673
|
this.__u = 0, this.o = null, this.__b = null;
|
|
15769
15674
|
}
|
|
15770
15675
|
function j$1(n) {
|
|
@@ -15777,7 +15682,7 @@
|
|
|
15777
15682
|
l$2.unmount = function (n) {
|
|
15778
15683
|
var t = n.__c;
|
|
15779
15684
|
t && (t.__z = true), t && t.__R && t.__R(), t && 32 & n.__u && (n.type = null), U$1 && U$1(n);
|
|
15780
|
-
}, (P$
|
|
15685
|
+
}, (P$1.prototype = new C$2()).__c = function (n, t) {
|
|
15781
15686
|
var e = t.__c,
|
|
15782
15687
|
r = this;
|
|
15783
15688
|
null == r.o && (r.o = []), r.o.push(e);
|
|
@@ -15804,9 +15709,9 @@
|
|
|
15804
15709
|
r.__u++ || 32 & t.__u || r.setState({
|
|
15805
15710
|
__a: r.__b = r.__v.__k[0]
|
|
15806
15711
|
}), n.then(i, i);
|
|
15807
|
-
}, P$
|
|
15712
|
+
}, P$1.prototype.componentWillUnmount = function () {
|
|
15808
15713
|
this.o = [];
|
|
15809
|
-
}, P$
|
|
15714
|
+
}, P$1.prototype.render = function (n, e) {
|
|
15810
15715
|
if (this.__b) {
|
|
15811
15716
|
if (this.__v.__k) {
|
|
15812
15717
|
var r = document.createElement("div"),
|
|
@@ -28835,7 +28740,7 @@ ${e}</tr>
|
|
|
28835
28740
|
return n;
|
|
28836
28741
|
}
|
|
28837
28742
|
};
|
|
28838
|
-
var P
|
|
28743
|
+
var P = class {
|
|
28839
28744
|
options;
|
|
28840
28745
|
block;
|
|
28841
28746
|
constructor(e) {
|
|
@@ -28872,7 +28777,7 @@ ${e}</tr>
|
|
|
28872
28777
|
TextRenderer = L$1;
|
|
28873
28778
|
Lexer = x;
|
|
28874
28779
|
Tokenizer = w;
|
|
28875
|
-
Hooks = P
|
|
28780
|
+
Hooks = P;
|
|
28876
28781
|
constructor(...e) {
|
|
28877
28782
|
this.use(...e);
|
|
28878
28783
|
}
|
|
@@ -28958,15 +28863,15 @@ ${e}</tr>
|
|
|
28958
28863
|
s.tokenizer = r;
|
|
28959
28864
|
}
|
|
28960
28865
|
if (n.hooks) {
|
|
28961
|
-
let r = this.defaults.hooks || new P
|
|
28866
|
+
let r = this.defaults.hooks || new P();
|
|
28962
28867
|
for (let i in n.hooks) {
|
|
28963
28868
|
if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
|
|
28964
28869
|
if (["options", "block"].includes(i)) continue;
|
|
28965
28870
|
let o = i,
|
|
28966
28871
|
u = n.hooks[o],
|
|
28967
28872
|
a = r[o];
|
|
28968
|
-
P
|
|
28969
|
-
if (this.defaults.async && P
|
|
28873
|
+
P.passThroughHooks.has(i) ? r[o] = c => {
|
|
28874
|
+
if (this.defaults.async && P.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
28970
28875
|
let k = await u.call(r, c);
|
|
28971
28876
|
return a.call(r, k);
|
|
28972
28877
|
})();
|
|
@@ -29076,7 +28981,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
29076
28981
|
g.Lexer = x;
|
|
29077
28982
|
g.lexer = x.lex;
|
|
29078
28983
|
g.Tokenizer = w;
|
|
29079
|
-
g.Hooks = P
|
|
28984
|
+
g.Hooks = P;
|
|
29080
28985
|
g.parse = g;
|
|
29081
28986
|
g.options;
|
|
29082
28987
|
g.setOptions;
|
|
@@ -29109,7 +29014,26 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
29109
29014
|
// if using special depth accessors, use a more complex extraction
|
|
29110
29015
|
return Array.from(_smartExtractVariableNames(node, depth, specialDepthAccessors));
|
|
29111
29016
|
}
|
|
29112
|
-
if (depth === 0 && node.name === 'VariableName') return [node.variableName];
|
|
29017
|
+
if (depth === 0 && node.name === 'VariableName') return [_cleanupVariableName(node.variableName)];
|
|
29018
|
+
|
|
29019
|
+
// skip function names - the function name is the only direct VariableName child of a
|
|
29020
|
+
// FunctionInvocation (arguments are nested under Positional/NamedParameters), so drop it
|
|
29021
|
+
if (node.name === 'FunctionInvocation') {
|
|
29022
|
+
const args = node.children.filter(child => child.name !== 'VariableName');
|
|
29023
|
+
return args.reduce((acc, child) => acc.concat(_unfoldVariables(child)), []);
|
|
29024
|
+
}
|
|
29025
|
+
|
|
29026
|
+
// skip type names in instance of expressions
|
|
29027
|
+
if (node.name === 'Type') {
|
|
29028
|
+
return [];
|
|
29029
|
+
}
|
|
29030
|
+
|
|
29031
|
+
// handle quantified (some...satisfies) and for expressions - exclude bound iteration variables
|
|
29032
|
+
if (node.name === 'QuantifiedExpression' || node.name === 'ForExpression') {
|
|
29033
|
+
const boundNames = _collectBoundVariableNames(node);
|
|
29034
|
+
const variables = node.children.reduce((acc, child) => acc.concat(_unfoldVariables(child)), []);
|
|
29035
|
+
return variables.filter(name => !boundNames.includes(name));
|
|
29036
|
+
}
|
|
29113
29037
|
|
|
29114
29038
|
// for any other kind of node, traverse its children and flatten the result
|
|
29115
29039
|
if (node.children) {
|
|
@@ -29234,6 +29158,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
29234
29158
|
if (node.type.name === 'VariableName') {
|
|
29235
29159
|
nodeRepresentation.variableName = feelString.slice(node.from, node.to);
|
|
29236
29160
|
}
|
|
29161
|
+
if (node.type.name === 'Name') {
|
|
29162
|
+
nodeRepresentation.variableName = feelString.slice(node.from, node.to);
|
|
29163
|
+
}
|
|
29237
29164
|
stack.push(nodeRepresentation);
|
|
29238
29165
|
},
|
|
29239
29166
|
leave: () => {
|
|
@@ -29282,6 +29209,53 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
29282
29209
|
iterate(tree);
|
|
29283
29210
|
return flattenedExpressionTree;
|
|
29284
29211
|
};
|
|
29212
|
+
|
|
29213
|
+
/**
|
|
29214
|
+
* FEEL keywords that may be incorrectly absorbed into variable names by the parser.
|
|
29215
|
+
* For example, `variable1 not in (...)` parses as VariableName "variable1 not".
|
|
29216
|
+
*/
|
|
29217
|
+
const FEEL_TRAILING_KEYWORDS = ['not'];
|
|
29218
|
+
|
|
29219
|
+
/**
|
|
29220
|
+
* Cleans up a variable name by stripping trailing FEEL keywords that the parser
|
|
29221
|
+
* may have incorrectly included as part of the variable name.
|
|
29222
|
+
*
|
|
29223
|
+
* @param {string} variableName - The raw variable name from the parse tree.
|
|
29224
|
+
* @returns {string} The cleaned variable name.
|
|
29225
|
+
*/
|
|
29226
|
+
const _cleanupVariableName = variableName => {
|
|
29227
|
+
for (const keyword of FEEL_TRAILING_KEYWORDS) {
|
|
29228
|
+
if (variableName.endsWith(' ' + keyword)) {
|
|
29229
|
+
return variableName.slice(0, -(keyword.length + 1));
|
|
29230
|
+
}
|
|
29231
|
+
}
|
|
29232
|
+
return variableName;
|
|
29233
|
+
};
|
|
29234
|
+
|
|
29235
|
+
/**
|
|
29236
|
+
* Collects the names of variables bound by iteration constructs (e.g. `for x in ...`, `some x in ...`).
|
|
29237
|
+
* These are locally scoped and should be excluded from the extracted variable set.
|
|
29238
|
+
*
|
|
29239
|
+
* @param {Object} node - A QuantifiedExpression or ForExpression node.
|
|
29240
|
+
* @returns {string[]} The bound variable names.
|
|
29241
|
+
*/
|
|
29242
|
+
const _collectBoundVariableNames = node => {
|
|
29243
|
+
const boundNames = [];
|
|
29244
|
+
const collect = n => {
|
|
29245
|
+
if (n.name === 'InExpression') {
|
|
29246
|
+
// The Name node inside an InExpression is the bound iteration variable
|
|
29247
|
+
const nameNode = n.children.find(child => child.name === 'Name');
|
|
29248
|
+
if (nameNode && nameNode.variableName) {
|
|
29249
|
+
boundNames.push(nameNode.variableName);
|
|
29250
|
+
}
|
|
29251
|
+
}
|
|
29252
|
+
if (n.children) {
|
|
29253
|
+
n.children.forEach(collect);
|
|
29254
|
+
}
|
|
29255
|
+
};
|
|
29256
|
+
collect(node);
|
|
29257
|
+
return boundNames;
|
|
29258
|
+
};
|
|
29285
29259
|
class FeelExpressionLanguage {
|
|
29286
29260
|
constructor(eventBus) {
|
|
29287
29261
|
this._eventBus = eventBus;
|
|
@@ -32979,7 +32953,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
32979
32953
|
})));
|
|
32980
32954
|
};
|
|
32981
32955
|
function countDecimals$1(number) {
|
|
32982
|
-
const num = Big
|
|
32956
|
+
const num = Big(number);
|
|
32983
32957
|
if (num.toString() === num.toFixed(0)) return 0;
|
|
32984
32958
|
return num.toFixed().split('.')[1].length || 0;
|
|
32985
32959
|
}
|
|
@@ -33098,15 +33072,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33098
33072
|
|
|
33099
33073
|
// caches the value an increment/decrement operation will be based on
|
|
33100
33074
|
const incrementAmount = T$3(() => {
|
|
33101
|
-
if (incrementValue) return Big
|
|
33102
|
-
if (decimalDigits) return Big
|
|
33103
|
-
return Big
|
|
33075
|
+
if (incrementValue) return Big(incrementValue);
|
|
33076
|
+
if (decimalDigits) return Big(`1e-${decimalDigits}`);
|
|
33077
|
+
return Big('1');
|
|
33104
33078
|
}, [decimalDigits, incrementValue]);
|
|
33105
33079
|
const increment = () => {
|
|
33106
33080
|
if (readonly) {
|
|
33107
33081
|
return;
|
|
33108
33082
|
}
|
|
33109
|
-
const base = isValidNumber$1(cachedValue) ? Big
|
|
33083
|
+
const base = isValidNumber$1(cachedValue) ? Big(cachedValue) : Big(0);
|
|
33110
33084
|
const stepFlooredValue = base.minus(base.mod(incrementAmount));
|
|
33111
33085
|
|
|
33112
33086
|
// note: toFixed() behaves differently in big.js
|
|
@@ -33116,7 +33090,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
33116
33090
|
if (readonly) {
|
|
33117
33091
|
return;
|
|
33118
33092
|
}
|
|
33119
|
-
const base = isValidNumber$1(cachedValue) ? Big
|
|
33093
|
+
const base = isValidNumber$1(cachedValue) ? Big(cachedValue) : Big(0);
|
|
33120
33094
|
const offset = base.mod(incrementAmount);
|
|
33121
33095
|
if (offset.cmp(0) === 0) {
|
|
33122
33096
|
// if we're already on a valid step, decrement
|
|
@@ -35291,11 +35265,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35291
35265
|
if (!isValidDocumentEndpoint(finalEndpoint)) {
|
|
35292
35266
|
return null;
|
|
35293
35267
|
}
|
|
35294
|
-
const requestInit = getDocumentRequestInit(documentEndpointBuilder, document);
|
|
35295
35268
|
return u(DocumentRenderer, {
|
|
35296
35269
|
documentMetadata: document,
|
|
35270
|
+
documentEndpointBuilder: documentEndpointBuilder,
|
|
35297
35271
|
endpoint: finalEndpoint,
|
|
35298
|
-
requestInit: requestInit,
|
|
35299
35272
|
maxHeight: maxHeight,
|
|
35300
35273
|
domId: `${domId}-${index}`
|
|
35301
35274
|
}, document.documentId);
|
|
@@ -35477,9 +35450,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35477
35450
|
*
|
|
35478
35451
|
* @param {Object} props
|
|
35479
35452
|
* @param {DocumentMetadata} props.documentMetadata
|
|
35453
|
+
* @param {DocumentEndpointBuilder | null} props.documentEndpointBuilder
|
|
35480
35454
|
* @param {string} props.endpoint
|
|
35481
35455
|
* @param {string} props.domId
|
|
35482
|
-
* @param {RequestInit|undefined} props.requestInit
|
|
35483
35456
|
* @param {number|undefined} props.maxHeight
|
|
35484
35457
|
*
|
|
35485
35458
|
* @returns {import("preact").JSX.Element}
|
|
@@ -35487,10 +35460,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35487
35460
|
function DocumentRenderer(props) {
|
|
35488
35461
|
const {
|
|
35489
35462
|
documentMetadata,
|
|
35463
|
+
documentEndpointBuilder,
|
|
35490
35464
|
endpoint,
|
|
35491
35465
|
maxHeight,
|
|
35492
|
-
domId
|
|
35493
|
-
requestInit
|
|
35466
|
+
domId
|
|
35494
35467
|
} = props;
|
|
35495
35468
|
const {
|
|
35496
35469
|
metadata
|
|
@@ -35498,6 +35471,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35498
35471
|
const [hasError, setHasError] = d$1(false);
|
|
35499
35472
|
const ref = A$2(null);
|
|
35500
35473
|
const isInViewport = useInViewport(ref);
|
|
35474
|
+
const onError = q$2(() => setHasError(true), []);
|
|
35475
|
+
const requestInit = T$3(() => getDocumentRequestInit(documentEndpointBuilder, documentMetadata), [documentEndpointBuilder, documentMetadata]);
|
|
35501
35476
|
const singleDocumentContainerClassName = `fjs-${type$k}-single-document-container`;
|
|
35502
35477
|
const errorMessageId = `${domId}-error-message`;
|
|
35503
35478
|
const errorMessage = 'Unable to download document';
|
|
@@ -35513,14 +35488,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35513
35488
|
url: endpoint,
|
|
35514
35489
|
alt: metadata.fileName,
|
|
35515
35490
|
requestInit: requestInit,
|
|
35516
|
-
onError:
|
|
35491
|
+
onError: onError
|
|
35517
35492
|
}), u(DownloadButton, {
|
|
35518
35493
|
endpoint: endpoint,
|
|
35519
35494
|
fileName: metadata.fileName,
|
|
35520
35495
|
requestInit: requestInit,
|
|
35521
|
-
onDownloadError:
|
|
35522
|
-
setHasError(true);
|
|
35523
|
-
}
|
|
35496
|
+
onDownloadError: onError
|
|
35524
35497
|
}), hasError ? u(Errors, {
|
|
35525
35498
|
id: errorMessageId,
|
|
35526
35499
|
errors: [errorMessage]
|
|
@@ -35538,7 +35511,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35538
35511
|
url: endpoint,
|
|
35539
35512
|
fileName: metadata.fileName,
|
|
35540
35513
|
requestInit: requestInit,
|
|
35541
|
-
onError:
|
|
35514
|
+
onError: onError,
|
|
35542
35515
|
errorMessageId: errorMessageId
|
|
35543
35516
|
})
|
|
35544
35517
|
});
|
|
@@ -35559,9 +35532,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
35559
35532
|
endpoint: endpoint,
|
|
35560
35533
|
fileName: metadata.fileName,
|
|
35561
35534
|
requestInit: requestInit,
|
|
35562
|
-
onDownloadError:
|
|
35563
|
-
setHasError(true);
|
|
35564
|
-
}
|
|
35535
|
+
onDownloadError: onError
|
|
35565
35536
|
})]
|
|
35566
35537
|
});
|
|
35567
35538
|
}
|
|
@@ -37741,8 +37712,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37741
37712
|
errors.push('Value is expected to ' + (decimalDigits === 0 ? 'be an integer' : `have at most ${decimalDigits} decimal digit${decimalDigits > 1 ? 's' : ''}`) + '.');
|
|
37742
37713
|
}
|
|
37743
37714
|
if (increment) {
|
|
37744
|
-
const bigValue = Big
|
|
37745
|
-
const bigIncrement = Big
|
|
37715
|
+
const bigValue = Big(value);
|
|
37716
|
+
const bigIncrement = Big(increment);
|
|
37746
37717
|
const offset = bigValue.mod(bigIncrement);
|
|
37747
37718
|
if (offset.cmp(0) !== 0) {
|
|
37748
37719
|
const previousValue = bigValue.minus(offset);
|
|
@@ -37768,7 +37739,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37768
37739
|
}
|
|
37769
37740
|
if ('min' in validation && (value || value === 0)) {
|
|
37770
37741
|
try {
|
|
37771
|
-
if (Big
|
|
37742
|
+
if (Big(value).lt(Big(validation.min))) {
|
|
37772
37743
|
errors.push(`Field must have minimum value of ${validation.min}.`);
|
|
37773
37744
|
}
|
|
37774
37745
|
} catch {
|
|
@@ -37777,7 +37748,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
37777
37748
|
}
|
|
37778
37749
|
if ('max' in validation && (value || value === 0)) {
|
|
37779
37750
|
try {
|
|
37780
|
-
if (Big
|
|
37751
|
+
if (Big(value).gt(Big(validation.max))) {
|
|
37781
37752
|
errors.push(`Field must have maximum value of ${validation.max}.`);
|
|
37782
37753
|
}
|
|
37783
37754
|
} catch {
|
|
@@ -71681,941 +71652,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
71681
71652
|
return trap;
|
|
71682
71653
|
};
|
|
71683
71654
|
|
|
71684
|
-
/*
|
|
71685
|
-
* big.js v7.0.1
|
|
71686
|
-
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
71687
|
-
* Copyright (c) 2025 Michael Mclaughlin
|
|
71688
|
-
* https://github.com/MikeMcl/big.js/LICENCE.md
|
|
71689
|
-
*/
|
|
71690
|
-
|
|
71691
|
-
/************************************** EDITABLE DEFAULTS *****************************************/
|
|
71692
|
-
|
|
71693
|
-
// The default values below must be integers within the stated ranges.
|
|
71694
|
-
|
|
71695
|
-
/*
|
|
71696
|
-
* The maximum number of decimal places (DP) of the results of operations involving division:
|
|
71697
|
-
* div and sqrt, and pow with negative exponents.
|
|
71698
|
-
*/
|
|
71699
|
-
var DP = 20,
|
|
71700
|
-
// 0 to MAX_DP
|
|
71701
|
-
|
|
71702
|
-
/*
|
|
71703
|
-
* The rounding mode (RM) used when rounding to the above decimal places.
|
|
71704
|
-
*
|
|
71705
|
-
* 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
|
|
71706
|
-
* 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
|
|
71707
|
-
* 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
|
|
71708
|
-
* 3 Away from zero. (ROUND_UP)
|
|
71709
|
-
*/
|
|
71710
|
-
RM = 1,
|
|
71711
|
-
// 0, 1, 2 or 3
|
|
71712
|
-
|
|
71713
|
-
// The maximum value of DP and Big.DP.
|
|
71714
|
-
MAX_DP = 1E6,
|
|
71715
|
-
// 0 to 1000000
|
|
71716
|
-
|
|
71717
|
-
// The maximum magnitude of the exponent argument to the pow method.
|
|
71718
|
-
MAX_POWER = 1E6,
|
|
71719
|
-
// 1 to 1000000
|
|
71720
|
-
|
|
71721
|
-
/*
|
|
71722
|
-
* The negative exponent (NE) at and beneath which toString returns exponential notation.
|
|
71723
|
-
* (JavaScript numbers: -7)
|
|
71724
|
-
* -1000000 is the minimum recommended exponent value of a Big.
|
|
71725
|
-
*/
|
|
71726
|
-
NE = -7,
|
|
71727
|
-
// 0 to -1000000
|
|
71728
|
-
|
|
71729
|
-
/*
|
|
71730
|
-
* The positive exponent (PE) at and above which toString returns exponential notation.
|
|
71731
|
-
* (JavaScript numbers: 21)
|
|
71732
|
-
* 1000000 is the maximum recommended exponent value of a Big, but this limit is not enforced.
|
|
71733
|
-
*/
|
|
71734
|
-
PE = 21,
|
|
71735
|
-
// 0 to 1000000
|
|
71736
|
-
|
|
71737
|
-
/*
|
|
71738
|
-
* When true, an error will be thrown if a primitive number is passed to the Big constructor,
|
|
71739
|
-
* or if valueOf is called, or if toNumber is called on a Big which cannot be converted to a
|
|
71740
|
-
* primitive number without a loss of precision.
|
|
71741
|
-
*/
|
|
71742
|
-
STRICT = false,
|
|
71743
|
-
// true or false
|
|
71744
|
-
|
|
71745
|
-
/**************************************************************************************************/
|
|
71746
|
-
|
|
71747
|
-
// Error messages.
|
|
71748
|
-
NAME = '[big.js] ',
|
|
71749
|
-
INVALID = NAME + 'Invalid ',
|
|
71750
|
-
INVALID_DP = INVALID + 'decimal places',
|
|
71751
|
-
INVALID_RM = INVALID + 'rounding mode',
|
|
71752
|
-
DIV_BY_ZERO = NAME + 'Division by zero',
|
|
71753
|
-
// The shared prototype object.
|
|
71754
|
-
P = {},
|
|
71755
|
-
UNDEFINED = void 0,
|
|
71756
|
-
NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
|
|
71757
|
-
|
|
71758
|
-
/*
|
|
71759
|
-
* Create and return a Big constructor.
|
|
71760
|
-
*/
|
|
71761
|
-
function _Big_() {
|
|
71762
|
-
/*
|
|
71763
|
-
* The Big constructor and exported function.
|
|
71764
|
-
* Create and return a new instance of a Big number object.
|
|
71765
|
-
*
|
|
71766
|
-
* n {number|string|Big} A numeric value.
|
|
71767
|
-
*/
|
|
71768
|
-
function Big(n) {
|
|
71769
|
-
var x = this;
|
|
71770
|
-
|
|
71771
|
-
// Enable constructor usage without new.
|
|
71772
|
-
if (!(x instanceof Big)) {
|
|
71773
|
-
return n === UNDEFINED && arguments.length === 0 ? _Big_() : new Big(n);
|
|
71774
|
-
}
|
|
71775
|
-
|
|
71776
|
-
// Duplicate.
|
|
71777
|
-
if (n instanceof Big) {
|
|
71778
|
-
x.s = n.s;
|
|
71779
|
-
x.e = n.e;
|
|
71780
|
-
x.c = n.c.slice();
|
|
71781
|
-
} else {
|
|
71782
|
-
if (typeof n !== 'string') {
|
|
71783
|
-
if (Big.strict === true && typeof n !== 'bigint') {
|
|
71784
|
-
throw TypeError(INVALID + 'value');
|
|
71785
|
-
}
|
|
71786
|
-
|
|
71787
|
-
// Minus zero?
|
|
71788
|
-
n = n === 0 && 1 / n < 0 ? '-0' : String(n);
|
|
71789
|
-
}
|
|
71790
|
-
parse(x, n);
|
|
71791
|
-
}
|
|
71792
|
-
|
|
71793
|
-
// Retain a reference to this Big constructor.
|
|
71794
|
-
// Shadow Big.prototype.constructor which points to Object.
|
|
71795
|
-
x.constructor = Big;
|
|
71796
|
-
}
|
|
71797
|
-
Big.prototype = P;
|
|
71798
|
-
Big.DP = DP;
|
|
71799
|
-
Big.RM = RM;
|
|
71800
|
-
Big.NE = NE;
|
|
71801
|
-
Big.PE = PE;
|
|
71802
|
-
Big.strict = STRICT;
|
|
71803
|
-
Big.roundDown = 0;
|
|
71804
|
-
Big.roundHalfUp = 1;
|
|
71805
|
-
Big.roundHalfEven = 2;
|
|
71806
|
-
Big.roundUp = 3;
|
|
71807
|
-
return Big;
|
|
71808
|
-
}
|
|
71809
|
-
|
|
71810
|
-
/*
|
|
71811
|
-
* Parse the number or string value passed to a Big constructor.
|
|
71812
|
-
*
|
|
71813
|
-
* x {Big} A Big number instance.
|
|
71814
|
-
* n {number|string} A numeric value.
|
|
71815
|
-
*/
|
|
71816
|
-
function parse(x, n) {
|
|
71817
|
-
var e, i, nl;
|
|
71818
|
-
if (!NUMERIC.test(n)) {
|
|
71819
|
-
throw Error(INVALID + 'number');
|
|
71820
|
-
}
|
|
71821
|
-
|
|
71822
|
-
// Determine sign.
|
|
71823
|
-
x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1;
|
|
71824
|
-
|
|
71825
|
-
// Decimal point?
|
|
71826
|
-
if ((e = n.indexOf('.')) > -1) n = n.replace('.', '');
|
|
71827
|
-
|
|
71828
|
-
// Exponential form?
|
|
71829
|
-
if ((i = n.search(/e/i)) > 0) {
|
|
71830
|
-
// Determine exponent.
|
|
71831
|
-
if (e < 0) e = i;
|
|
71832
|
-
e += +n.slice(i + 1);
|
|
71833
|
-
n = n.substring(0, i);
|
|
71834
|
-
} else if (e < 0) {
|
|
71835
|
-
// Integer.
|
|
71836
|
-
e = n.length;
|
|
71837
|
-
}
|
|
71838
|
-
nl = n.length;
|
|
71839
|
-
|
|
71840
|
-
// Determine leading zeros.
|
|
71841
|
-
for (i = 0; i < nl && n.charAt(i) == '0';) ++i;
|
|
71842
|
-
if (i == nl) {
|
|
71843
|
-
// Zero.
|
|
71844
|
-
x.c = [x.e = 0];
|
|
71845
|
-
} else {
|
|
71846
|
-
// Determine trailing zeros.
|
|
71847
|
-
for (; nl > 0 && n.charAt(--nl) == '0';);
|
|
71848
|
-
x.e = e - i - 1;
|
|
71849
|
-
x.c = [];
|
|
71850
|
-
|
|
71851
|
-
// Convert string to array of digits without leading/trailing zeros.
|
|
71852
|
-
for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++);
|
|
71853
|
-
}
|
|
71854
|
-
return x;
|
|
71855
|
-
}
|
|
71856
|
-
|
|
71857
|
-
/*
|
|
71858
|
-
* Round Big x to a maximum of sd significant digits using rounding mode rm.
|
|
71859
|
-
*
|
|
71860
|
-
* x {Big} The Big to round.
|
|
71861
|
-
* sd {number} Significant digits: integer, 0 to MAX_DP inclusive.
|
|
71862
|
-
* rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
71863
|
-
* [more] {boolean} Whether the result of division was truncated.
|
|
71864
|
-
*/
|
|
71865
|
-
function round(x, sd, rm, more) {
|
|
71866
|
-
var xc = x.c;
|
|
71867
|
-
if (rm === UNDEFINED) rm = x.constructor.RM;
|
|
71868
|
-
if (rm !== 0 && rm !== 1 && rm !== 2 && rm !== 3) {
|
|
71869
|
-
throw Error(INVALID_RM);
|
|
71870
|
-
}
|
|
71871
|
-
if (sd < 1) {
|
|
71872
|
-
more = rm === 3 && (more || !!xc[0]) || sd === 0 && (rm === 1 && xc[0] >= 5 || rm === 2 && (xc[0] > 5 || xc[0] === 5 && (more || xc[1] !== UNDEFINED)));
|
|
71873
|
-
xc.length = 1;
|
|
71874
|
-
if (more) {
|
|
71875
|
-
// 1, 0.1, 0.01, 0.001, 0.0001 etc.
|
|
71876
|
-
x.e = x.e - sd + 1;
|
|
71877
|
-
xc[0] = 1;
|
|
71878
|
-
} else {
|
|
71879
|
-
// Zero.
|
|
71880
|
-
xc[0] = x.e = 0;
|
|
71881
|
-
}
|
|
71882
|
-
} else if (sd < xc.length) {
|
|
71883
|
-
// xc[sd] is the digit after the digit that may be rounded up.
|
|
71884
|
-
more = rm === 1 && xc[sd] >= 5 || rm === 2 && (xc[sd] > 5 || xc[sd] === 5 && (more || xc[sd + 1] !== UNDEFINED || xc[sd - 1] & 1)) || rm === 3 && (more || !!xc[0]);
|
|
71885
|
-
|
|
71886
|
-
// Remove any digits after the required precision.
|
|
71887
|
-
xc.length = sd;
|
|
71888
|
-
|
|
71889
|
-
// Round up?
|
|
71890
|
-
if (more) {
|
|
71891
|
-
// Rounding up may mean the previous digit has to be rounded up.
|
|
71892
|
-
for (; ++xc[--sd] > 9;) {
|
|
71893
|
-
xc[sd] = 0;
|
|
71894
|
-
if (sd === 0) {
|
|
71895
|
-
++x.e;
|
|
71896
|
-
xc.unshift(1);
|
|
71897
|
-
break;
|
|
71898
|
-
}
|
|
71899
|
-
}
|
|
71900
|
-
}
|
|
71901
|
-
|
|
71902
|
-
// Remove trailing zeros.
|
|
71903
|
-
for (sd = xc.length; !xc[--sd];) xc.pop();
|
|
71904
|
-
}
|
|
71905
|
-
return x;
|
|
71906
|
-
}
|
|
71907
|
-
|
|
71908
|
-
/*
|
|
71909
|
-
* Return a string representing the value of Big x in normal or exponential notation.
|
|
71910
|
-
* Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
|
|
71911
|
-
*/
|
|
71912
|
-
function stringify(x, doExponential, isNonzero) {
|
|
71913
|
-
var e = x.e,
|
|
71914
|
-
s = x.c.join(''),
|
|
71915
|
-
n = s.length;
|
|
71916
|
-
|
|
71917
|
-
// Exponential notation?
|
|
71918
|
-
if (doExponential) {
|
|
71919
|
-
s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e;
|
|
71920
|
-
|
|
71921
|
-
// Normal notation.
|
|
71922
|
-
} else if (e < 0) {
|
|
71923
|
-
for (; ++e;) s = '0' + s;
|
|
71924
|
-
s = '0.' + s;
|
|
71925
|
-
} else if (e > 0) {
|
|
71926
|
-
if (++e > n) {
|
|
71927
|
-
for (e -= n; e--;) s += '0';
|
|
71928
|
-
} else if (e < n) {
|
|
71929
|
-
s = s.slice(0, e) + '.' + s.slice(e);
|
|
71930
|
-
}
|
|
71931
|
-
} else if (n > 1) {
|
|
71932
|
-
s = s.charAt(0) + '.' + s.slice(1);
|
|
71933
|
-
}
|
|
71934
|
-
return x.s < 0 && isNonzero ? '-' + s : s;
|
|
71935
|
-
}
|
|
71936
|
-
|
|
71937
|
-
// Prototype/instance methods
|
|
71938
|
-
|
|
71939
|
-
/*
|
|
71940
|
-
* Return a new Big whose value is the absolute value of this Big.
|
|
71941
|
-
*/
|
|
71942
|
-
P.abs = function () {
|
|
71943
|
-
var x = new this.constructor(this);
|
|
71944
|
-
x.s = 1;
|
|
71945
|
-
return x;
|
|
71946
|
-
};
|
|
71947
|
-
|
|
71948
|
-
/*
|
|
71949
|
-
* Return 1 if the value of this Big is greater than the value of Big y,
|
|
71950
|
-
* -1 if the value of this Big is less than the value of Big y, or
|
|
71951
|
-
* 0 if they have the same value.
|
|
71952
|
-
*/
|
|
71953
|
-
P.cmp = function (y) {
|
|
71954
|
-
var isneg,
|
|
71955
|
-
x = this,
|
|
71956
|
-
xc = x.c,
|
|
71957
|
-
yc = (y = new x.constructor(y)).c,
|
|
71958
|
-
i = x.s,
|
|
71959
|
-
j = y.s,
|
|
71960
|
-
k = x.e,
|
|
71961
|
-
l = y.e;
|
|
71962
|
-
|
|
71963
|
-
// Either zero?
|
|
71964
|
-
if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i;
|
|
71965
|
-
|
|
71966
|
-
// Signs differ?
|
|
71967
|
-
if (i != j) return i;
|
|
71968
|
-
isneg = i < 0;
|
|
71969
|
-
|
|
71970
|
-
// Compare exponents.
|
|
71971
|
-
if (k != l) return k > l ^ isneg ? 1 : -1;
|
|
71972
|
-
j = (k = xc.length) < (l = yc.length) ? k : l;
|
|
71973
|
-
|
|
71974
|
-
// Compare digit by digit.
|
|
71975
|
-
for (i = -1; ++i < j;) {
|
|
71976
|
-
if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1;
|
|
71977
|
-
}
|
|
71978
|
-
|
|
71979
|
-
// Compare lengths.
|
|
71980
|
-
return k == l ? 0 : k > l ^ isneg ? 1 : -1;
|
|
71981
|
-
};
|
|
71982
|
-
|
|
71983
|
-
/*
|
|
71984
|
-
* Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
|
|
71985
|
-
* if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
71986
|
-
*/
|
|
71987
|
-
P.div = function (y) {
|
|
71988
|
-
var x = this,
|
|
71989
|
-
Big = x.constructor,
|
|
71990
|
-
a = x.c,
|
|
71991
|
-
// dividend
|
|
71992
|
-
b = (y = new Big(y)).c,
|
|
71993
|
-
// divisor
|
|
71994
|
-
k = x.s == y.s ? 1 : -1,
|
|
71995
|
-
dp = Big.DP;
|
|
71996
|
-
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
|
|
71997
|
-
throw Error(INVALID_DP);
|
|
71998
|
-
}
|
|
71999
|
-
|
|
72000
|
-
// Divisor is zero?
|
|
72001
|
-
if (!b[0]) {
|
|
72002
|
-
throw Error(DIV_BY_ZERO);
|
|
72003
|
-
}
|
|
72004
|
-
|
|
72005
|
-
// Dividend is 0? Return +-0.
|
|
72006
|
-
if (!a[0]) {
|
|
72007
|
-
y.s = k;
|
|
72008
|
-
y.c = [y.e = 0];
|
|
72009
|
-
return y;
|
|
72010
|
-
}
|
|
72011
|
-
var bl,
|
|
72012
|
-
bt,
|
|
72013
|
-
n,
|
|
72014
|
-
cmp,
|
|
72015
|
-
ri,
|
|
72016
|
-
bz = b.slice(),
|
|
72017
|
-
ai = bl = b.length,
|
|
72018
|
-
al = a.length,
|
|
72019
|
-
r = a.slice(0, bl),
|
|
72020
|
-
// remainder
|
|
72021
|
-
rl = r.length,
|
|
72022
|
-
q = y,
|
|
72023
|
-
// quotient
|
|
72024
|
-
qc = q.c = [],
|
|
72025
|
-
qi = 0,
|
|
72026
|
-
p = dp + (q.e = x.e - y.e) + 1; // precision of the result
|
|
72027
|
-
|
|
72028
|
-
q.s = k;
|
|
72029
|
-
k = p < 0 ? 0 : p;
|
|
72030
|
-
|
|
72031
|
-
// Create version of divisor with leading zero.
|
|
72032
|
-
bz.unshift(0);
|
|
72033
|
-
|
|
72034
|
-
// Add zeros to make remainder as long as divisor.
|
|
72035
|
-
for (; rl++ < bl;) r.push(0);
|
|
72036
|
-
do {
|
|
72037
|
-
// n is how many times the divisor goes into current remainder.
|
|
72038
|
-
for (n = 0; n < 10; n++) {
|
|
72039
|
-
// Compare divisor and remainder.
|
|
72040
|
-
if (bl != (rl = r.length)) {
|
|
72041
|
-
cmp = bl > rl ? 1 : -1;
|
|
72042
|
-
} else {
|
|
72043
|
-
for (ri = -1, cmp = 0; ++ri < bl;) {
|
|
72044
|
-
if (b[ri] != r[ri]) {
|
|
72045
|
-
cmp = b[ri] > r[ri] ? 1 : -1;
|
|
72046
|
-
break;
|
|
72047
|
-
}
|
|
72048
|
-
}
|
|
72049
|
-
}
|
|
72050
|
-
|
|
72051
|
-
// If divisor < remainder, subtract divisor from remainder.
|
|
72052
|
-
if (cmp < 0) {
|
|
72053
|
-
// Remainder can't be more than 1 digit longer than divisor.
|
|
72054
|
-
// Equalise lengths using divisor with extra leading zero?
|
|
72055
|
-
for (bt = rl == bl ? b : bz; rl;) {
|
|
72056
|
-
if (r[--rl] < bt[rl]) {
|
|
72057
|
-
ri = rl;
|
|
72058
|
-
for (; ri && !r[--ri];) r[ri] = 9;
|
|
72059
|
-
--r[ri];
|
|
72060
|
-
r[rl] += 10;
|
|
72061
|
-
}
|
|
72062
|
-
r[rl] -= bt[rl];
|
|
72063
|
-
}
|
|
72064
|
-
for (; !r[0];) r.shift();
|
|
72065
|
-
} else {
|
|
72066
|
-
break;
|
|
72067
|
-
}
|
|
72068
|
-
}
|
|
72069
|
-
|
|
72070
|
-
// Add the digit n to the result array.
|
|
72071
|
-
qc[qi++] = cmp ? n : ++n;
|
|
72072
|
-
|
|
72073
|
-
// Update the remainder.
|
|
72074
|
-
if (r[0] && cmp) r[rl] = a[ai] || 0;else r = [a[ai]];
|
|
72075
|
-
} while ((ai++ < al || r[0] !== UNDEFINED) && k--);
|
|
72076
|
-
|
|
72077
|
-
// Leading zero? Do not remove if result is simply zero (qi == 1).
|
|
72078
|
-
if (!qc[0] && qi != 1) {
|
|
72079
|
-
// There can't be more than one zero.
|
|
72080
|
-
qc.shift();
|
|
72081
|
-
q.e--;
|
|
72082
|
-
p--;
|
|
72083
|
-
}
|
|
72084
|
-
|
|
72085
|
-
// Round?
|
|
72086
|
-
if (qi > p) round(q, p, Big.RM, r[0] !== UNDEFINED);
|
|
72087
|
-
return q;
|
|
72088
|
-
};
|
|
72089
|
-
|
|
72090
|
-
/*
|
|
72091
|
-
* Return true if the value of this Big is equal to the value of Big y, otherwise return false.
|
|
72092
|
-
*/
|
|
72093
|
-
P.eq = function (y) {
|
|
72094
|
-
return this.cmp(y) === 0;
|
|
72095
|
-
};
|
|
72096
|
-
|
|
72097
|
-
/*
|
|
72098
|
-
* Return true if the value of this Big is greater than the value of Big y, otherwise return
|
|
72099
|
-
* false.
|
|
72100
|
-
*/
|
|
72101
|
-
P.gt = function (y) {
|
|
72102
|
-
return this.cmp(y) > 0;
|
|
72103
|
-
};
|
|
72104
|
-
|
|
72105
|
-
/*
|
|
72106
|
-
* Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
|
|
72107
|
-
* return false.
|
|
72108
|
-
*/
|
|
72109
|
-
P.gte = function (y) {
|
|
72110
|
-
return this.cmp(y) > -1;
|
|
72111
|
-
};
|
|
72112
|
-
|
|
72113
|
-
/*
|
|
72114
|
-
* Return true if the value of this Big is less than the value of Big y, otherwise return false.
|
|
72115
|
-
*/
|
|
72116
|
-
P.lt = function (y) {
|
|
72117
|
-
return this.cmp(y) < 0;
|
|
72118
|
-
};
|
|
72119
|
-
|
|
72120
|
-
/*
|
|
72121
|
-
* Return true if the value of this Big is less than or equal to the value of Big y, otherwise
|
|
72122
|
-
* return false.
|
|
72123
|
-
*/
|
|
72124
|
-
P.lte = function (y) {
|
|
72125
|
-
return this.cmp(y) < 1;
|
|
72126
|
-
};
|
|
72127
|
-
|
|
72128
|
-
/*
|
|
72129
|
-
* Return a new Big whose value is the value of this Big minus the value of Big y.
|
|
72130
|
-
*/
|
|
72131
|
-
P.minus = P.sub = function (y) {
|
|
72132
|
-
var i,
|
|
72133
|
-
j,
|
|
72134
|
-
t,
|
|
72135
|
-
xlty,
|
|
72136
|
-
x = this,
|
|
72137
|
-
Big = x.constructor,
|
|
72138
|
-
a = x.s,
|
|
72139
|
-
b = (y = new Big(y)).s;
|
|
72140
|
-
|
|
72141
|
-
// Signs differ?
|
|
72142
|
-
if (a != b) {
|
|
72143
|
-
y.s = -b;
|
|
72144
|
-
return x.plus(y);
|
|
72145
|
-
}
|
|
72146
|
-
var xc = x.c.slice(),
|
|
72147
|
-
xe = x.e,
|
|
72148
|
-
yc = y.c,
|
|
72149
|
-
ye = y.e;
|
|
72150
|
-
|
|
72151
|
-
// Either zero?
|
|
72152
|
-
if (!xc[0] || !yc[0]) {
|
|
72153
|
-
if (yc[0]) {
|
|
72154
|
-
y.s = -b;
|
|
72155
|
-
} else if (xc[0]) {
|
|
72156
|
-
y = new Big(x);
|
|
72157
|
-
} else {
|
|
72158
|
-
y.s = 1;
|
|
72159
|
-
}
|
|
72160
|
-
return y;
|
|
72161
|
-
}
|
|
72162
|
-
|
|
72163
|
-
// Determine which is the bigger number. Prepend zeros to equalise exponents.
|
|
72164
|
-
if (a = xe - ye) {
|
|
72165
|
-
if (xlty = a < 0) {
|
|
72166
|
-
a = -a;
|
|
72167
|
-
t = xc;
|
|
72168
|
-
} else {
|
|
72169
|
-
ye = xe;
|
|
72170
|
-
t = yc;
|
|
72171
|
-
}
|
|
72172
|
-
t.reverse();
|
|
72173
|
-
for (b = a; b--;) t.push(0);
|
|
72174
|
-
t.reverse();
|
|
72175
|
-
} else {
|
|
72176
|
-
// Exponents equal. Check digit by digit.
|
|
72177
|
-
j = ((xlty = xc.length < yc.length) ? xc : yc).length;
|
|
72178
|
-
for (a = b = 0; b < j; b++) {
|
|
72179
|
-
if (xc[b] != yc[b]) {
|
|
72180
|
-
xlty = xc[b] < yc[b];
|
|
72181
|
-
break;
|
|
72182
|
-
}
|
|
72183
|
-
}
|
|
72184
|
-
}
|
|
72185
|
-
|
|
72186
|
-
// x < y? Point xc to the array of the bigger number.
|
|
72187
|
-
if (xlty) {
|
|
72188
|
-
t = xc;
|
|
72189
|
-
xc = yc;
|
|
72190
|
-
yc = t;
|
|
72191
|
-
y.s = -y.s;
|
|
72192
|
-
}
|
|
72193
|
-
|
|
72194
|
-
/*
|
|
72195
|
-
* Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
|
|
72196
|
-
* needs to start at yc.length.
|
|
72197
|
-
*/
|
|
72198
|
-
if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0;
|
|
72199
|
-
|
|
72200
|
-
// Subtract yc from xc.
|
|
72201
|
-
for (b = i; j > a;) {
|
|
72202
|
-
if (xc[--j] < yc[j]) {
|
|
72203
|
-
for (i = j; i && !xc[--i];) xc[i] = 9;
|
|
72204
|
-
--xc[i];
|
|
72205
|
-
xc[j] += 10;
|
|
72206
|
-
}
|
|
72207
|
-
xc[j] -= yc[j];
|
|
72208
|
-
}
|
|
72209
|
-
|
|
72210
|
-
// Remove trailing zeros.
|
|
72211
|
-
for (; xc[--b] === 0;) xc.pop();
|
|
72212
|
-
|
|
72213
|
-
// Remove leading zeros and adjust exponent accordingly.
|
|
72214
|
-
for (; xc[0] === 0;) {
|
|
72215
|
-
xc.shift();
|
|
72216
|
-
--ye;
|
|
72217
|
-
}
|
|
72218
|
-
if (!xc[0]) {
|
|
72219
|
-
// n - n = +0
|
|
72220
|
-
y.s = 1;
|
|
72221
|
-
|
|
72222
|
-
// Result must be zero.
|
|
72223
|
-
xc = [ye = 0];
|
|
72224
|
-
}
|
|
72225
|
-
y.c = xc;
|
|
72226
|
-
y.e = ye;
|
|
72227
|
-
return y;
|
|
72228
|
-
};
|
|
72229
|
-
|
|
72230
|
-
/*
|
|
72231
|
-
* Return a new Big whose value is the value of this Big modulo the value of Big y.
|
|
72232
|
-
*/
|
|
72233
|
-
P.mod = function (y) {
|
|
72234
|
-
var ygtx,
|
|
72235
|
-
x = this,
|
|
72236
|
-
Big = x.constructor,
|
|
72237
|
-
a = x.s,
|
|
72238
|
-
b = (y = new Big(y)).s;
|
|
72239
|
-
if (!y.c[0]) {
|
|
72240
|
-
throw Error(DIV_BY_ZERO);
|
|
72241
|
-
}
|
|
72242
|
-
x.s = y.s = 1;
|
|
72243
|
-
ygtx = y.cmp(x) == 1;
|
|
72244
|
-
x.s = a;
|
|
72245
|
-
y.s = b;
|
|
72246
|
-
if (ygtx) return new Big(x);
|
|
72247
|
-
a = Big.DP;
|
|
72248
|
-
b = Big.RM;
|
|
72249
|
-
Big.DP = Big.RM = 0;
|
|
72250
|
-
x = x.div(y);
|
|
72251
|
-
Big.DP = a;
|
|
72252
|
-
Big.RM = b;
|
|
72253
|
-
return this.minus(x.times(y));
|
|
72254
|
-
};
|
|
72255
|
-
|
|
72256
|
-
/*
|
|
72257
|
-
* Return a new Big whose value is the value of this Big negated.
|
|
72258
|
-
*/
|
|
72259
|
-
P.neg = function () {
|
|
72260
|
-
var x = new this.constructor(this);
|
|
72261
|
-
x.s = -x.s;
|
|
72262
|
-
return x;
|
|
72263
|
-
};
|
|
72264
|
-
|
|
72265
|
-
/*
|
|
72266
|
-
* Return a new Big whose value is the value of this Big plus the value of Big y.
|
|
72267
|
-
*/
|
|
72268
|
-
P.plus = P.add = function (y) {
|
|
72269
|
-
var e,
|
|
72270
|
-
k,
|
|
72271
|
-
t,
|
|
72272
|
-
x = this,
|
|
72273
|
-
Big = x.constructor;
|
|
72274
|
-
y = new Big(y);
|
|
72275
|
-
|
|
72276
|
-
// Signs differ?
|
|
72277
|
-
if (x.s != y.s) {
|
|
72278
|
-
y.s = -y.s;
|
|
72279
|
-
return x.minus(y);
|
|
72280
|
-
}
|
|
72281
|
-
var xe = x.e,
|
|
72282
|
-
xc = x.c,
|
|
72283
|
-
ye = y.e,
|
|
72284
|
-
yc = y.c;
|
|
72285
|
-
|
|
72286
|
-
// Either zero?
|
|
72287
|
-
if (!xc[0] || !yc[0]) {
|
|
72288
|
-
if (!yc[0]) {
|
|
72289
|
-
if (xc[0]) {
|
|
72290
|
-
y = new Big(x);
|
|
72291
|
-
} else {
|
|
72292
|
-
y.s = x.s;
|
|
72293
|
-
}
|
|
72294
|
-
}
|
|
72295
|
-
return y;
|
|
72296
|
-
}
|
|
72297
|
-
xc = xc.slice();
|
|
72298
|
-
|
|
72299
|
-
// Prepend zeros to equalise exponents.
|
|
72300
|
-
// Note: reverse faster than unshifts.
|
|
72301
|
-
if (e = xe - ye) {
|
|
72302
|
-
if (e > 0) {
|
|
72303
|
-
ye = xe;
|
|
72304
|
-
t = yc;
|
|
72305
|
-
} else {
|
|
72306
|
-
e = -e;
|
|
72307
|
-
t = xc;
|
|
72308
|
-
}
|
|
72309
|
-
t.reverse();
|
|
72310
|
-
for (; e--;) t.push(0);
|
|
72311
|
-
t.reverse();
|
|
72312
|
-
}
|
|
72313
|
-
|
|
72314
|
-
// Point xc to the longer array.
|
|
72315
|
-
if (xc.length - yc.length < 0) {
|
|
72316
|
-
t = yc;
|
|
72317
|
-
yc = xc;
|
|
72318
|
-
xc = t;
|
|
72319
|
-
}
|
|
72320
|
-
e = yc.length;
|
|
72321
|
-
|
|
72322
|
-
// Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
|
|
72323
|
-
for (k = 0; e; xc[e] %= 10) k = (xc[--e] = xc[e] + yc[e] + k) / 10 | 0;
|
|
72324
|
-
|
|
72325
|
-
// No need to check for zero, as +x + +y != 0 && -x + -y != 0
|
|
72326
|
-
|
|
72327
|
-
if (k) {
|
|
72328
|
-
xc.unshift(k);
|
|
72329
|
-
++ye;
|
|
72330
|
-
}
|
|
72331
|
-
|
|
72332
|
-
// Remove trailing zeros.
|
|
72333
|
-
for (e = xc.length; xc[--e] === 0;) xc.pop();
|
|
72334
|
-
y.c = xc;
|
|
72335
|
-
y.e = ye;
|
|
72336
|
-
return y;
|
|
72337
|
-
};
|
|
72338
|
-
|
|
72339
|
-
/*
|
|
72340
|
-
* Return a Big whose value is the value of this Big raised to the power n.
|
|
72341
|
-
* If n is negative, round to a maximum of Big.DP decimal places using rounding
|
|
72342
|
-
* mode Big.RM.
|
|
72343
|
-
*
|
|
72344
|
-
* n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
|
|
72345
|
-
*/
|
|
72346
|
-
P.pow = function (n) {
|
|
72347
|
-
var x = this,
|
|
72348
|
-
one = new x.constructor('1'),
|
|
72349
|
-
y = one,
|
|
72350
|
-
isneg = n < 0;
|
|
72351
|
-
if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) {
|
|
72352
|
-
throw Error(INVALID + 'exponent');
|
|
72353
|
-
}
|
|
72354
|
-
if (isneg) n = -n;
|
|
72355
|
-
for (;;) {
|
|
72356
|
-
if (n & 1) y = y.times(x);
|
|
72357
|
-
n >>= 1;
|
|
72358
|
-
if (!n) break;
|
|
72359
|
-
x = x.times(x);
|
|
72360
|
-
}
|
|
72361
|
-
return isneg ? one.div(y) : y;
|
|
72362
|
-
};
|
|
72363
|
-
|
|
72364
|
-
/*
|
|
72365
|
-
* Return a new Big whose value is the value of this Big rounded to a maximum precision of sd
|
|
72366
|
-
* significant digits using rounding mode rm, or Big.RM if rm is not specified.
|
|
72367
|
-
*
|
|
72368
|
-
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
72369
|
-
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
72370
|
-
*/
|
|
72371
|
-
P.prec = function (sd, rm) {
|
|
72372
|
-
if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
|
|
72373
|
-
throw Error(INVALID + 'precision');
|
|
72374
|
-
}
|
|
72375
|
-
return round(new this.constructor(this), sd, rm);
|
|
72376
|
-
};
|
|
72377
|
-
|
|
72378
|
-
/*
|
|
72379
|
-
* Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
|
|
72380
|
-
* using rounding mode rm, or Big.RM if rm is not specified.
|
|
72381
|
-
* If dp is negative, round to an integer which is a multiple of 10**-dp.
|
|
72382
|
-
* If dp is not specified, round to 0 decimal places.
|
|
72383
|
-
*
|
|
72384
|
-
* dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
|
|
72385
|
-
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
72386
|
-
*/
|
|
72387
|
-
P.round = function (dp, rm) {
|
|
72388
|
-
if (dp === UNDEFINED) dp = 0;else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) {
|
|
72389
|
-
throw Error(INVALID_DP);
|
|
72390
|
-
}
|
|
72391
|
-
return round(new this.constructor(this), dp + this.e + 1, rm);
|
|
72392
|
-
};
|
|
72393
|
-
|
|
72394
|
-
/*
|
|
72395
|
-
* Return a new Big whose value is the square root of the value of this Big, rounded, if
|
|
72396
|
-
* necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
72397
|
-
*/
|
|
72398
|
-
P.sqrt = function () {
|
|
72399
|
-
var r,
|
|
72400
|
-
c,
|
|
72401
|
-
t,
|
|
72402
|
-
x = this,
|
|
72403
|
-
Big = x.constructor,
|
|
72404
|
-
s = x.s,
|
|
72405
|
-
e = x.e,
|
|
72406
|
-
half = new Big('0.5');
|
|
72407
|
-
|
|
72408
|
-
// Zero?
|
|
72409
|
-
if (!x.c[0]) return new Big(x);
|
|
72410
|
-
|
|
72411
|
-
// Negative?
|
|
72412
|
-
if (s < 0) {
|
|
72413
|
-
throw Error(NAME + 'No square root');
|
|
72414
|
-
}
|
|
72415
|
-
|
|
72416
|
-
// Estimate.
|
|
72417
|
-
s = Math.sqrt(+stringify(x, true, true));
|
|
72418
|
-
|
|
72419
|
-
// Math.sqrt underflow/overflow?
|
|
72420
|
-
// Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
|
|
72421
|
-
if (s === 0 || s === 1 / 0) {
|
|
72422
|
-
c = x.c.join('');
|
|
72423
|
-
if (!(c.length + e & 1)) c += '0';
|
|
72424
|
-
s = Math.sqrt(c);
|
|
72425
|
-
e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
|
|
72426
|
-
r = new Big((s == 1 / 0 ? '5e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
|
|
72427
|
-
} else {
|
|
72428
|
-
r = new Big(s + '');
|
|
72429
|
-
}
|
|
72430
|
-
e = r.e + (Big.DP += 4);
|
|
72431
|
-
|
|
72432
|
-
// Newton-Raphson iteration.
|
|
72433
|
-
do {
|
|
72434
|
-
t = r;
|
|
72435
|
-
r = half.times(t.plus(x.div(t)));
|
|
72436
|
-
} while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join(''));
|
|
72437
|
-
return round(r, (Big.DP -= 4) + r.e + 1, Big.RM);
|
|
72438
|
-
};
|
|
72439
|
-
|
|
72440
|
-
/*
|
|
72441
|
-
* Return a new Big whose value is the value of this Big times the value of Big y.
|
|
72442
|
-
*/
|
|
72443
|
-
P.times = P.mul = function (y) {
|
|
72444
|
-
var c,
|
|
72445
|
-
x = this,
|
|
72446
|
-
Big = x.constructor,
|
|
72447
|
-
xc = x.c,
|
|
72448
|
-
yc = (y = new Big(y)).c,
|
|
72449
|
-
a = xc.length,
|
|
72450
|
-
b = yc.length,
|
|
72451
|
-
i = x.e,
|
|
72452
|
-
j = y.e;
|
|
72453
|
-
|
|
72454
|
-
// Determine sign of result.
|
|
72455
|
-
y.s = x.s == y.s ? 1 : -1;
|
|
72456
|
-
|
|
72457
|
-
// Return signed 0 if either 0.
|
|
72458
|
-
if (!xc[0] || !yc[0]) {
|
|
72459
|
-
y.c = [y.e = 0];
|
|
72460
|
-
return y;
|
|
72461
|
-
}
|
|
72462
|
-
|
|
72463
|
-
// Initialise exponent of result as x.e + y.e.
|
|
72464
|
-
y.e = i + j;
|
|
72465
|
-
|
|
72466
|
-
// If array xc has fewer digits than yc, swap xc and yc, and lengths.
|
|
72467
|
-
if (a < b) {
|
|
72468
|
-
c = xc;
|
|
72469
|
-
xc = yc;
|
|
72470
|
-
yc = c;
|
|
72471
|
-
j = a;
|
|
72472
|
-
a = b;
|
|
72473
|
-
b = j;
|
|
72474
|
-
}
|
|
72475
|
-
|
|
72476
|
-
// Initialise coefficient array of result with zeros.
|
|
72477
|
-
for (c = new Array(j = a + b); j--;) c[j] = 0;
|
|
72478
|
-
|
|
72479
|
-
// Multiply.
|
|
72480
|
-
|
|
72481
|
-
// i is initially xc.length.
|
|
72482
|
-
for (i = b; i--;) {
|
|
72483
|
-
b = 0;
|
|
72484
|
-
|
|
72485
|
-
// a is yc.length.
|
|
72486
|
-
for (j = a + i; j > i;) {
|
|
72487
|
-
// Current sum of products at this digit position, plus carry.
|
|
72488
|
-
b = c[j] + yc[i] * xc[j - i - 1] + b;
|
|
72489
|
-
c[j--] = b % 10;
|
|
72490
|
-
|
|
72491
|
-
// carry
|
|
72492
|
-
b = b / 10 | 0;
|
|
72493
|
-
}
|
|
72494
|
-
c[j] = b;
|
|
72495
|
-
}
|
|
72496
|
-
|
|
72497
|
-
// Increment result exponent if there is a final carry, otherwise remove leading zero.
|
|
72498
|
-
if (b) ++y.e;else c.shift();
|
|
72499
|
-
|
|
72500
|
-
// Remove trailing zeros.
|
|
72501
|
-
for (i = c.length; !c[--i];) c.pop();
|
|
72502
|
-
y.c = c;
|
|
72503
|
-
return y;
|
|
72504
|
-
};
|
|
72505
|
-
|
|
72506
|
-
/*
|
|
72507
|
-
* Return a string representing the value of this Big in exponential notation rounded to dp fixed
|
|
72508
|
-
* decimal places using rounding mode rm, or Big.RM if rm is not specified.
|
|
72509
|
-
*
|
|
72510
|
-
* dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
|
|
72511
|
-
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
72512
|
-
*/
|
|
72513
|
-
P.toExponential = function (dp, rm) {
|
|
72514
|
-
var x = this,
|
|
72515
|
-
n = x.c[0];
|
|
72516
|
-
if (dp !== UNDEFINED) {
|
|
72517
|
-
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
|
|
72518
|
-
throw Error(INVALID_DP);
|
|
72519
|
-
}
|
|
72520
|
-
x = round(new x.constructor(x), ++dp, rm);
|
|
72521
|
-
for (; x.c.length < dp;) x.c.push(0);
|
|
72522
|
-
}
|
|
72523
|
-
return stringify(x, true, !!n);
|
|
72524
|
-
};
|
|
72525
|
-
|
|
72526
|
-
/*
|
|
72527
|
-
* Return a string representing the value of this Big in normal notation rounded to dp fixed
|
|
72528
|
-
* decimal places using rounding mode rm, or Big.RM if rm is not specified.
|
|
72529
|
-
*
|
|
72530
|
-
* dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
|
|
72531
|
-
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
72532
|
-
*
|
|
72533
|
-
* (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
|
|
72534
|
-
* (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
|
|
72535
|
-
*/
|
|
72536
|
-
P.toFixed = function (dp, rm) {
|
|
72537
|
-
var x = this,
|
|
72538
|
-
n = x.c[0];
|
|
72539
|
-
if (dp !== UNDEFINED) {
|
|
72540
|
-
if (dp !== ~~dp || dp < 0 || dp > MAX_DP) {
|
|
72541
|
-
throw Error(INVALID_DP);
|
|
72542
|
-
}
|
|
72543
|
-
x = round(new x.constructor(x), dp + x.e + 1, rm);
|
|
72544
|
-
|
|
72545
|
-
// x.e may have changed if the value is rounded up.
|
|
72546
|
-
for (dp = dp + x.e + 1; x.c.length < dp;) x.c.push(0);
|
|
72547
|
-
}
|
|
72548
|
-
return stringify(x, false, !!n);
|
|
72549
|
-
};
|
|
72550
|
-
|
|
72551
|
-
/*
|
|
72552
|
-
* Return a string representing the value of this Big.
|
|
72553
|
-
* Return exponential notation if this Big has a positive exponent equal to or greater than
|
|
72554
|
-
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
72555
|
-
* Omit the sign for negative zero.
|
|
72556
|
-
*/
|
|
72557
|
-
P.toJSON = P.toString = function () {
|
|
72558
|
-
var x = this,
|
|
72559
|
-
Big = x.constructor;
|
|
72560
|
-
return stringify(x, x.e <= Big.NE || x.e >= Big.PE, !!x.c[0]);
|
|
72561
|
-
};
|
|
72562
|
-
if (typeof Symbol !== "undefined") {
|
|
72563
|
-
P[Symbol.for('nodejs.util.inspect.custom')] = P.toJSON;
|
|
72564
|
-
}
|
|
72565
|
-
|
|
72566
|
-
/*
|
|
72567
|
-
* Return the value of this Big as a primitive number.
|
|
72568
|
-
*/
|
|
72569
|
-
P.toNumber = function () {
|
|
72570
|
-
var n = +stringify(this, true, true);
|
|
72571
|
-
if (this.constructor.strict === true && !this.eq(n.toString())) {
|
|
72572
|
-
throw Error(NAME + 'Imprecise conversion');
|
|
72573
|
-
}
|
|
72574
|
-
return n;
|
|
72575
|
-
};
|
|
72576
|
-
|
|
72577
|
-
/*
|
|
72578
|
-
* Return a string representing the value of this Big rounded to sd significant digits using
|
|
72579
|
-
* rounding mode rm, or Big.RM if rm is not specified.
|
|
72580
|
-
* Use exponential notation if sd is less than the number of digits necessary to represent
|
|
72581
|
-
* the integer part of the value in normal notation.
|
|
72582
|
-
*
|
|
72583
|
-
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
72584
|
-
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
72585
|
-
*/
|
|
72586
|
-
P.toPrecision = function (sd, rm) {
|
|
72587
|
-
var x = this,
|
|
72588
|
-
Big = x.constructor,
|
|
72589
|
-
n = x.c[0];
|
|
72590
|
-
if (sd !== UNDEFINED) {
|
|
72591
|
-
if (sd !== ~~sd || sd < 1 || sd > MAX_DP) {
|
|
72592
|
-
throw Error(INVALID + 'precision');
|
|
72593
|
-
}
|
|
72594
|
-
x = round(new Big(x), sd, rm);
|
|
72595
|
-
for (; x.c.length < sd;) x.c.push(0);
|
|
72596
|
-
}
|
|
72597
|
-
return stringify(x, sd <= x.e || x.e <= Big.NE || x.e >= Big.PE, !!n);
|
|
72598
|
-
};
|
|
72599
|
-
|
|
72600
|
-
/*
|
|
72601
|
-
* Return a string representing the value of this Big.
|
|
72602
|
-
* Return exponential notation if this Big has a positive exponent equal to or greater than
|
|
72603
|
-
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
72604
|
-
* Include the sign for negative zero.
|
|
72605
|
-
*/
|
|
72606
|
-
P.valueOf = function () {
|
|
72607
|
-
var x = this,
|
|
72608
|
-
Big = x.constructor;
|
|
72609
|
-
if (Big.strict === true) {
|
|
72610
|
-
throw Error(NAME + 'valueOf disallowed');
|
|
72611
|
-
}
|
|
72612
|
-
return stringify(x, x.e <= Big.NE || x.e >= Big.PE, true);
|
|
72613
|
-
};
|
|
72614
|
-
|
|
72615
|
-
// Export
|
|
72616
|
-
|
|
72617
|
-
var Big = _Big_();
|
|
72618
|
-
|
|
72619
71655
|
var FN_REF = '__fn';
|
|
72620
71656
|
var DEFAULT_PRIORITY$4 = 1000;
|
|
72621
71657
|
var slice = Array.prototype.slice;
|