Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-big-decimal

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-big-decimal - npm Package Compare versions

Comparing version 1.4.1 to 2.0.0

dist/esm/abs.d.ts

14

dist/node/big-decimal.d.ts

@@ -1,2 +0,2 @@

import { RoundingModes as Modes } from './roundingModes';
import { RoundingModes as Modes } from "./roundingModes";
declare class bigDecimal {

@@ -6,7 +6,7 @@ private value;

private static validate;
constructor(number?: (number | string | bigint));
constructor(number?: number | string | bigint);
getValue(): string;
setValue(num: (number | string | bigint)): void;
static getPrettyValue(number: any, digits: any, separator: any): string;
getPrettyValue(digits: any, separator: any): string;
setValue(num: number | string | bigint): void;
static getPrettyValue(number: any, digits?: number, separator?: string): string;
getPrettyValue(digits?: number, separator?: string): string;
static round(number: any, precision?: number, mode?: Modes): string;

@@ -26,3 +26,3 @@ round(precision?: number, mode?: Modes): bigDecimal;

multiply(number: bigDecimal): bigDecimal;
static divide(number1: any, number2: any, precision: any): string;
static divide(number1: any, number2: any, precision?: number): string;
divide(number: bigDecimal, precision: any): bigDecimal;

@@ -36,2 +36,2 @@ static modulus(number1: any, number2: any): string;

}
export = bigDecimal;
export default bigDecimal;

@@ -22,5 +22,5 @@ (function webpackUniversalModuleDefinition(root, factory) {

function abs(n) {
if (typeof n == 'number' || typeof n == 'bigint')
if (typeof n == "number" || typeof n == "bigint")
n = n.toString();
if (n[0] == '-')
if (n[0] == "-")
return n.substring(1);

@@ -46,3 +46,3 @@ return n;

//check for negatives
if (number1[0] == '-') {
if (number1[0] == "-") {
number1 = number1.substring(1);

@@ -55,3 +55,3 @@ if (!testZero(number1)) {

}
if (number2[0] == '-') {
if (number2[0] == "-") {
number2 = number2.substring(1);

@@ -77,8 +77,8 @@ if (!testZero(number2)) {

else if (neg == 2)
return ('-' + trim(res));
return "-" + trim(res);
else {
if (number1.length < (res.length))
if (number1.length < res.length)
return trim(res.substring(1));
else
return ('-' + trim(compliment(res)));
return "-" + trim(compliment(res));
}

@@ -91,44 +91,52 @@ }

}
var s = '', l = number.length, dec = number.split('.')[1], ld = dec ? dec.length : 0;
var s = "", l = number.length, dec = number.split(".")[1], ld = dec ? dec.length : 0;
for (var i = 0; i < l; i++) {
if (number[i] >= '0' && number[i] <= '9')
s += (9 - parseInt(number[i]));
if (number[i] >= "0" && number[i] <= "9")
s += 9 - parseInt(number[i]);
else
s += number[i];
}
var one = (ld > 0) ? ('0.' + (new Array(ld)).join('0') + '1') : '1';
var one = ld > 0 ? "0." + new Array(ld).join("0") + "1" : "1";
return addCore(s, one);
}
function trim(number) {
var parts = number.split('.');
var parts = number.split(".");
if (!parts[0])
parts[0] = '0';
while (parts[0][0] == '0' && parts[0].length > 1)
parts[0] = "0";
while (parts[0][0] == "0" && parts[0].length > 1)
parts[0] = parts[0].substring(1);
return parts[0] + (parts[1] ? ('.' + parts[1]) : '');
return parts[0] + (parts[1] ? "." + parts[1] : "");
}
exports.trim = trim;
function pad(number1, number2) {
var parts1 = number1.split('.'), parts2 = number2.split('.');
var parts1 = number1.split("."), parts2 = number2.split(".");
//pad integral part
var length1 = parts1[0].length, length2 = parts2[0].length;
if (length1 > length2) {
parts2[0] = (new Array(Math.abs(length1 - length2) + 1)).join('0') + (parts2[0] ? parts2[0] : '');
parts2[0] =
new Array(Math.abs(length1 - length2) + 1).join("0") +
(parts2[0] ? parts2[0] : "");
}
else {
parts1[0] = (new Array(Math.abs(length1 - length2) + 1)).join('0') + (parts1[0] ? parts1[0] : '');
parts1[0] =
new Array(Math.abs(length1 - length2) + 1).join("0") +
(parts1[0] ? parts1[0] : "");
}
//pad fractional part
length1 = parts1[1] ? parts1[1].length : 0,
length2 = parts2[1] ? parts2[1].length : 0;
(length1 = parts1[1] ? parts1[1].length : 0),
(length2 = parts2[1] ? parts2[1].length : 0);
if (length1 || length2) {
if (length1 > length2) {
parts2[1] = (parts2[1] ? parts2[1] : '') + (new Array(Math.abs(length1 - length2) + 1)).join('0');
parts2[1] =
(parts2[1] ? parts2[1] : "") +
new Array(Math.abs(length1 - length2) + 1).join("0");
}
else {
parts1[1] = (parts1[1] ? parts1[1] : '') + (new Array(Math.abs(length1 - length2) + 1)).join('0');
parts1[1] =
(parts1[1] ? parts1[1] : "") +
new Array(Math.abs(length1 - length2) + 1).join("0");
}
}
number1 = parts1[0] + ((parts1[1]) ? ('.' + parts1[1]) : '');
number2 = parts2[0] + ((parts2[1]) ? ('.' + parts2[1]) : '');
number1 = parts1[0] + (parts1[1] ? "." + parts1[1] : "");
number2 = parts2[0] + (parts2[1] ? "." + parts2[1] : "");
return [number1, number2];

@@ -140,6 +148,6 @@ }

_a = pad(number1, number2), number1 = _a[0], number2 = _a[1];
var sum = '', carry = 0;
var sum = "", carry = 0;
for (var i = number1.length - 1; i >= 0; i--) {
if (number1[i] === '.') {
sum = '.' + sum;
if (number1[i] === ".") {
sum = "." + sum;
continue;

@@ -151,6 +159,6 @@ }

}
return carry ? (carry.toString() + sum) : sum;
return carry ? carry.toString() + sum : sum;
}
function testZero(number) {
return (/^0[0]*[.]{0,1}[0]*$/.test(number));
return /^0[0]*[.]{0,1}[0]*$/.test(number);
}

@@ -161,207 +169,2 @@

/***/ 423:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var add_1 = __webpack_require__(217);
var abs_1 = __webpack_require__(165);
var round_1 = __webpack_require__(350);
var multiply_1 = __webpack_require__(182);
var divide_1 = __webpack_require__(415);
var modulus_1 = __webpack_require__(213);
var compareTo_1 = __webpack_require__(664);
var subtract_1 = __webpack_require__(26);
var roundingModes_1 = __webpack_require__(916);
var bigDecimal = /** @class */ (function () {
function bigDecimal(number) {
if (number === void 0) { number = '0'; }
this.value = bigDecimal.validate(number);
}
bigDecimal.validate = function (number) {
if (number) {
number = number.toString();
if (isNaN(number))
throw Error("Parameter is not a number: " + number);
if (number[0] == '+')
number = number.substring(1);
}
else
number = '0';
//handle missing leading zero
if (number.startsWith('.'))
number = '0' + number;
else if (number.startsWith('-.'))
number = '-0' + number.substr(1);
//handle exponentiation
if (/e/i.test(number)) {
var _a = number.split(/[eE]/), mantisa = _a[0], exponent = _a[1];
mantisa = (0, add_1.trim)(mantisa);
var sign = '';
if (mantisa[0] == '-') {
sign = '-';
mantisa = mantisa.substring(1);
}
if (mantisa.indexOf('.') >= 0) {
exponent = parseInt(exponent) + mantisa.indexOf('.');
mantisa = mantisa.replace('.', '');
}
else {
exponent = parseInt(exponent) + mantisa.length;
}
if (mantisa.length < exponent) {
number = sign + mantisa + (new Array(exponent - mantisa.length + 1)).join('0');
}
else if (mantisa.length >= exponent && exponent > 0) {
number = sign + (0, add_1.trim)(mantisa.substring(0, exponent)) +
((mantisa.length > exponent) ? ('.' + mantisa.substring(exponent)) : '');
}
else {
number = sign + '0.' + (new Array(-exponent + 1)).join('0') + mantisa;
}
}
return number;
};
bigDecimal.prototype.getValue = function () {
return this.value;
};
bigDecimal.prototype.setValue = function (num) {
this.value = bigDecimal.validate(num);
};
bigDecimal.getPrettyValue = function (number, digits, separator) {
if (!(digits || separator)) {
digits = 3;
separator = ',';
}
else if (!(digits && separator)) {
throw Error('Illegal Arguments. Should pass both digits and separator or pass none');
}
number = bigDecimal.validate(number);
var neg = number.charAt(0) == '-';
if (neg)
number = number.substring(1);
var len = number.indexOf('.');
len = len > 0 ? len : (number.length);
var temp = '';
for (var i = len; i > 0;) {
if (i < digits) {
digits = i;
i = 0;
}
else
i -= digits;
temp = number.substring(i, i + digits) + ((i < (len - digits) && i >= 0) ? separator : '') + temp;
}
return (neg ? '-' : '') + temp + number.substring(len);
};
bigDecimal.prototype.getPrettyValue = function (digits, separator) {
return bigDecimal.getPrettyValue(this.value, digits, separator);
};
bigDecimal.round = function (number, precision, mode) {
if (precision === void 0) { precision = 0; }
if (mode === void 0) { mode = roundingModes_1.RoundingModes.HALF_EVEN; }
number = bigDecimal.validate(number);
// console.log(number)
if (isNaN(precision))
throw Error("Precision is not a number: " + precision);
return (0, round_1.roundOff)(number, precision, mode);
};
bigDecimal.prototype.round = function (precision, mode) {
if (precision === void 0) { precision = 0; }
if (mode === void 0) { mode = roundingModes_1.RoundingModes.HALF_EVEN; }
if (isNaN(precision))
throw Error("Precision is not a number: " + precision);
return new bigDecimal((0, round_1.roundOff)(this.value, precision, mode));
};
bigDecimal.abs = function (number) {
number = bigDecimal.validate(number);
return (0, abs_1.abs)(number);
};
bigDecimal.prototype.abs = function () {
return new bigDecimal((0, abs_1.abs)(this.value));
};
bigDecimal.floor = function (number) {
number = bigDecimal.validate(number);
if (number.indexOf('.') === -1)
return number;
return bigDecimal.round(number, 0, roundingModes_1.RoundingModes.FLOOR);
};
bigDecimal.prototype.floor = function () {
if (this.value.indexOf('.') === -1)
return new bigDecimal(this.value);
return new bigDecimal(this.value).round(0, roundingModes_1.RoundingModes.FLOOR);
};
bigDecimal.ceil = function (number) {
number = bigDecimal.validate(number);
if (number.indexOf('.') === -1)
return number;
return bigDecimal.round(number, 0, roundingModes_1.RoundingModes.CEILING);
};
bigDecimal.prototype.ceil = function () {
if (this.value.indexOf('.') === -1)
return new bigDecimal(this.value);
return new bigDecimal(this.value).round(0, roundingModes_1.RoundingModes.CEILING);
};
bigDecimal.add = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, add_1.add)(number1, number2);
};
bigDecimal.prototype.add = function (number) {
return new bigDecimal((0, add_1.add)(this.value, number.getValue()));
};
bigDecimal.subtract = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, subtract_1.subtract)(number1, number2);
};
bigDecimal.prototype.subtract = function (number) {
return new bigDecimal((0, subtract_1.subtract)(this.value, number.getValue()));
};
bigDecimal.multiply = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, multiply_1.multiply)(number1, number2);
};
bigDecimal.prototype.multiply = function (number) {
return new bigDecimal((0, multiply_1.multiply)(this.value, number.getValue()));
};
bigDecimal.divide = function (number1, number2, precision) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, divide_1.divide)(number1, number2, precision);
};
bigDecimal.prototype.divide = function (number, precision) {
return new bigDecimal((0, divide_1.divide)(this.value, number.getValue(), precision));
};
bigDecimal.modulus = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, modulus_1.modulus)(number1, number2);
};
bigDecimal.prototype.modulus = function (number) {
return new bigDecimal((0, modulus_1.modulus)(this.value, number.getValue()));
};
bigDecimal.compareTo = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, compareTo_1.compareTo)(number1, number2);
};
bigDecimal.prototype.compareTo = function (number) {
return (0, compareTo_1.compareTo)(this.value, number.getValue());
};
bigDecimal.negate = function (number) {
number = bigDecimal.validate(number);
return (0, subtract_1.negate)(number);
};
bigDecimal.prototype.negate = function () {
return new bigDecimal((0, subtract_1.negate)(this.value));
};
bigDecimal.RoundingModes = roundingModes_1.RoundingModes;
return bigDecimal;
}());
module.exports = bigDecimal;
/***/ }),
/***/ 664:

@@ -885,8 +688,216 @@ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {

/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __webpack_require__(423);
/******/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
var exports = __webpack_exports__;
Object.defineProperty(exports, "__esModule", ({ value: true }));
var add_1 = __webpack_require__(217);
var abs_1 = __webpack_require__(165);
var round_1 = __webpack_require__(350);
var multiply_1 = __webpack_require__(182);
var divide_1 = __webpack_require__(415);
var modulus_1 = __webpack_require__(213);
var compareTo_1 = __webpack_require__(664);
var subtract_1 = __webpack_require__(26);
var roundingModes_1 = __webpack_require__(916);
var bigDecimal = /** @class */ (function () {
function bigDecimal(number) {
if (number === void 0) { number = "0"; }
this.value = bigDecimal.validate(number);
}
bigDecimal.validate = function (number) {
if (number) {
number = number.toString();
if (isNaN(number))
throw Error("Parameter is not a number: " + number);
if (number[0] == "+")
number = number.substring(1);
}
else
number = "0";
//handle missing leading zero
if (number.startsWith("."))
number = "0" + number;
else if (number.startsWith("-."))
number = "-0" + number.substr(1);
//handle exponentiation
if (/e/i.test(number)) {
var _a = number.split(/[eE]/), mantisa = _a[0], exponent = _a[1];
mantisa = (0, add_1.trim)(mantisa);
var sign = "";
if (mantisa[0] == "-") {
sign = "-";
mantisa = mantisa.substring(1);
}
if (mantisa.indexOf(".") >= 0) {
exponent = parseInt(exponent) + mantisa.indexOf(".");
mantisa = mantisa.replace(".", "");
}
else {
exponent = parseInt(exponent) + mantisa.length;
}
if (mantisa.length < exponent) {
number =
sign + mantisa + new Array(exponent - mantisa.length + 1).join("0");
}
else if (mantisa.length >= exponent && exponent > 0) {
number =
sign +
(0, add_1.trim)(mantisa.substring(0, exponent)) +
(mantisa.length > exponent ? "." + mantisa.substring(exponent) : "");
}
else {
number = sign + "0." + new Array(-exponent + 1).join("0") + mantisa;
}
}
return number;
};
bigDecimal.prototype.getValue = function () {
return this.value;
};
bigDecimal.prototype.setValue = function (num) {
this.value = bigDecimal.validate(num);
};
bigDecimal.getPrettyValue = function (number, digits, separator) {
if (digits === void 0) { digits = 3; }
if (separator === void 0) { separator = ","; }
// if (!(digits || separator)) {
// digits = 3;
// separator = ',';
// } else if (!(digits && separator)) {
// throw Error('Illegal Arguments. Should pass both digits and separator or pass none');
// }
number = bigDecimal.validate(number);
var neg = number.charAt(0) == "-";
if (neg)
number = number.substring(1);
var len = number.indexOf(".");
len = len > 0 ? len : number.length;
var temp = "";
for (var i = len; i > 0;) {
if (i < digits) {
digits = i;
i = 0;
}
else
i -= digits;
temp =
number.substring(i, i + digits) +
(i < len - digits && i >= 0 ? separator : "") +
temp;
}
return (neg ? "-" : "") + temp + number.substring(len);
};
bigDecimal.prototype.getPrettyValue = function (digits, separator) {
if (digits === void 0) { digits = 3; }
if (separator === void 0) { separator = ","; }
return bigDecimal.getPrettyValue(this.value, digits, separator);
};
bigDecimal.round = function (number, precision, mode) {
if (precision === void 0) { precision = 0; }
if (mode === void 0) { mode = roundingModes_1.RoundingModes.HALF_EVEN; }
number = bigDecimal.validate(number);
// console.log(number)
if (isNaN(precision))
throw Error("Precision is not a number: " + precision);
return (0, round_1.roundOff)(number, precision, mode);
};
bigDecimal.prototype.round = function (precision, mode) {
if (precision === void 0) { precision = 0; }
if (mode === void 0) { mode = roundingModes_1.RoundingModes.HALF_EVEN; }
if (isNaN(precision))
throw Error("Precision is not a number: " + precision);
return new bigDecimal((0, round_1.roundOff)(this.value, precision, mode));
};
bigDecimal.abs = function (number) {
number = bigDecimal.validate(number);
return (0, abs_1.abs)(number);
};
bigDecimal.prototype.abs = function () {
return new bigDecimal((0, abs_1.abs)(this.value));
};
bigDecimal.floor = function (number) {
number = bigDecimal.validate(number);
if (number.indexOf(".") === -1)
return number;
return bigDecimal.round(number, 0, roundingModes_1.RoundingModes.FLOOR);
};
bigDecimal.prototype.floor = function () {
if (this.value.indexOf(".") === -1)
return new bigDecimal(this.value);
return new bigDecimal(this.value).round(0, roundingModes_1.RoundingModes.FLOOR);
};
bigDecimal.ceil = function (number) {
number = bigDecimal.validate(number);
if (number.indexOf(".") === -1)
return number;
return bigDecimal.round(number, 0, roundingModes_1.RoundingModes.CEILING);
};
bigDecimal.prototype.ceil = function () {
if (this.value.indexOf(".") === -1)
return new bigDecimal(this.value);
return new bigDecimal(this.value).round(0, roundingModes_1.RoundingModes.CEILING);
};
bigDecimal.add = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, add_1.add)(number1, number2);
};
bigDecimal.prototype.add = function (number) {
return new bigDecimal((0, add_1.add)(this.value, number.getValue()));
};
bigDecimal.subtract = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, subtract_1.subtract)(number1, number2);
};
bigDecimal.prototype.subtract = function (number) {
return new bigDecimal((0, subtract_1.subtract)(this.value, number.getValue()));
};
bigDecimal.multiply = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, multiply_1.multiply)(number1, number2);
};
bigDecimal.prototype.multiply = function (number) {
return new bigDecimal((0, multiply_1.multiply)(this.value, number.getValue()));
};
bigDecimal.divide = function (number1, number2, precision) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, divide_1.divide)(number1, number2, precision);
};
bigDecimal.prototype.divide = function (number, precision) {
return new bigDecimal((0, divide_1.divide)(this.value, number.getValue(), precision));
};
bigDecimal.modulus = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, modulus_1.modulus)(number1, number2);
};
bigDecimal.prototype.modulus = function (number) {
return new bigDecimal((0, modulus_1.modulus)(this.value, number.getValue()));
};
bigDecimal.compareTo = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, compareTo_1.compareTo)(number1, number2);
};
bigDecimal.prototype.compareTo = function (number) {
return (0, compareTo_1.compareTo)(this.value, number.getValue());
};
bigDecimal.negate = function (number) {
number = bigDecimal.validate(number);
return (0, subtract_1.negate)(number);
};
bigDecimal.prototype.negate = function () {
return new bigDecimal((0, subtract_1.negate)(this.value));
};
bigDecimal.RoundingModes = roundingModes_1.RoundingModes;
return bigDecimal;
}());
exports["default"] = bigDecimal;
}();
/******/ return __webpack_exports__;

@@ -893,0 +904,0 @@ /******/ })()

@@ -1,1 +0,1 @@

!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.bigDecimal=n():e.bigDecimal=n()}(global,(function(){return function(){"use strict";var e={165:function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.abs=void 0,n.abs=function(e){return"number"!=typeof e&&"bigint"!=typeof e||(e=e.toString()),"-"==e[0]?e.substring(1):e}},217:function(e,n){function t(e){if(u(e))return e;for(var n="",t=e.length,r=e.split(".")[1],i=r?r.length:0,a=0;a<t;a++)e[a]>="0"&&e[a]<="9"?n+=9-parseInt(e[a]):n+=e[a];return o(n,i>0?"0."+new Array(i).join("0")+"1":"1")}function r(e){var n=e.split(".");for(n[0]||(n[0]="0");"0"==n[0][0]&&n[0].length>1;)n[0]=n[0].substring(1);return n[0]+(n[1]?"."+n[1]:"")}function i(e,n){var t=e.split("."),r=n.split("."),i=t[0].length,o=r[0].length;return i>o?r[0]=new Array(Math.abs(i-o)+1).join("0")+(r[0]?r[0]:""):t[0]=new Array(Math.abs(i-o)+1).join("0")+(t[0]?t[0]:""),i=t[1]?t[1].length:0,o=r[1]?r[1].length:0,(i||o)&&(i>o?r[1]=(r[1]?r[1]:"")+new Array(Math.abs(i-o)+1).join("0"):t[1]=(t[1]?t[1]:"")+new Array(Math.abs(i-o)+1).join("0")),[e=t[0]+(t[1]?"."+t[1]:""),n=r[0]+(r[1]?"."+r[1]:"")]}function o(e,n){var t;e=(t=i(e,n))[0],n=t[1];for(var r="",o=0,u=e.length-1;u>=0;u--)if("."!==e[u]){var a=parseInt(e[u])+parseInt(n[u])+o;r=a%10+r,o=Math.floor(a/10)}else r="."+r;return o?o.toString()+r:r}function u(e){return/^0[0]*[.]{0,1}[0]*$/.test(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.pad=n.trim=n.add=void 0,n.add=function(e,n){var a;void 0===n&&(n="0");var s=0,d=-1;"-"==e[0]&&(u(e=e.substring(1))||(s++,d=1,e.length)),"-"==n[0]&&(u(n=n.substring(1))||(s++,d=2,n.length)),e=r(e),n=r(n),e=(a=i(r(e),r(n)))[0],n=a[1],1==s&&(1===d?e=t(e):2===d&&(n=t(n)));var l=o(e,n);return s?2==s?"-"+r(l):e.length<l.length?r(l.substring(1)):"-"+r(t(l)):r(l)},n.trim=r,n.pad=i},423:function(e,n,t){var r=t(217),i=t(165),o=t(350),u=t(182),a=t(415),s=t(213),d=t(664),l=t(26),f=t(916),g=function(){function e(n){void 0===n&&(n="0"),this.value=e.validate(n)}return e.validate=function(e){if(e){if(e=e.toString(),isNaN(e))throw Error("Parameter is not a number: "+e);"+"==e[0]&&(e=e.substring(1))}else e="0";if(e.startsWith(".")?e="0"+e:e.startsWith("-.")&&(e="-0"+e.substr(1)),/e/i.test(e)){var n=e.split(/[eE]/),t=n[0],i=n[1],o="";"-"==(t=(0,r.trim)(t))[0]&&(o="-",t=t.substring(1)),t.indexOf(".")>=0?(i=parseInt(i)+t.indexOf("."),t=t.replace(".","")):i=parseInt(i)+t.length,e=t.length<i?o+t+new Array(i-t.length+1).join("0"):t.length>=i&&i>0?o+(0,r.trim)(t.substring(0,i))+(t.length>i?"."+t.substring(i):""):o+"0."+new Array(1-i).join("0")+t}return e},e.prototype.getValue=function(){return this.value},e.prototype.setValue=function(n){this.value=e.validate(n)},e.getPrettyValue=function(n,t,r){if(t||r){if(!t||!r)throw Error("Illegal Arguments. Should pass both digits and separator or pass none")}else t=3,r=",";var i="-"==(n=e.validate(n)).charAt(0);i&&(n=n.substring(1));for(var o=n.indexOf("."),u="",a=o=o>0?o:n.length;a>0;)a<t?(t=a,a=0):a-=t,u=n.substring(a,a+t)+(a<o-t&&a>=0?r:"")+u;return(i?"-":"")+u+n.substring(o)},e.prototype.getPrettyValue=function(n,t){return e.getPrettyValue(this.value,n,t)},e.round=function(n,t,r){if(void 0===t&&(t=0),void 0===r&&(r=f.RoundingModes.HALF_EVEN),n=e.validate(n),isNaN(t))throw Error("Precision is not a number: "+t);return(0,o.roundOff)(n,t,r)},e.prototype.round=function(n,t){if(void 0===n&&(n=0),void 0===t&&(t=f.RoundingModes.HALF_EVEN),isNaN(n))throw Error("Precision is not a number: "+n);return new e((0,o.roundOff)(this.value,n,t))},e.abs=function(n){return n=e.validate(n),(0,i.abs)(n)},e.prototype.abs=function(){return new e((0,i.abs)(this.value))},e.floor=function(n){return-1===(n=e.validate(n)).indexOf(".")?n:e.round(n,0,f.RoundingModes.FLOOR)},e.prototype.floor=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,f.RoundingModes.FLOOR)},e.ceil=function(n){return-1===(n=e.validate(n)).indexOf(".")?n:e.round(n,0,f.RoundingModes.CEILING)},e.prototype.ceil=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,f.RoundingModes.CEILING)},e.add=function(n,t){return n=e.validate(n),t=e.validate(t),(0,r.add)(n,t)},e.prototype.add=function(n){return new e((0,r.add)(this.value,n.getValue()))},e.subtract=function(n,t){return n=e.validate(n),t=e.validate(t),(0,l.subtract)(n,t)},e.prototype.subtract=function(n){return new e((0,l.subtract)(this.value,n.getValue()))},e.multiply=function(n,t){return n=e.validate(n),t=e.validate(t),(0,u.multiply)(n,t)},e.prototype.multiply=function(n){return new e((0,u.multiply)(this.value,n.getValue()))},e.divide=function(n,t,r){return n=e.validate(n),t=e.validate(t),(0,a.divide)(n,t,r)},e.prototype.divide=function(n,t){return new e((0,a.divide)(this.value,n.getValue(),t))},e.modulus=function(n,t){return n=e.validate(n),t=e.validate(t),(0,s.modulus)(n,t)},e.prototype.modulus=function(n){return new e((0,s.modulus)(this.value,n.getValue()))},e.compareTo=function(n,t){return n=e.validate(n),t=e.validate(t),(0,d.compareTo)(n,t)},e.prototype.compareTo=function(e){return(0,d.compareTo)(this.value,e.getValue())},e.negate=function(n){return n=e.validate(n),(0,l.negate)(n)},e.prototype.negate=function(){return new e((0,l.negate)(this.value))},e.RoundingModes=f.RoundingModes,e}();e.exports=g},664:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.compareTo=void 0;var r=t(217);n.compareTo=function(e,n){var t,i=!1;if("-"==e[0]&&"-"!=n[0])return-1;if("-"!=e[0]&&"-"==n[0])return 1;if("-"==e[0]&&"-"==n[0]&&(e=e.substr(1),n=n.substr(1),i=!0),e=(t=(0,r.pad)(e,n))[0],n=t[1],0==e.localeCompare(n))return 0;for(var o=0;o<e.length;o++)if(e[o]!=n[o])return e[o]>n[o]?i?-1:1:i?1:-1;return 0}},415:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.divide=void 0;var r=t(217),i=t(350);n.divide=function(e,n,t){if(void 0===t&&(t=8),0==n)throw new Error("Cannot divide by 0");if(e=e.toString(),n=n.toString(),e=e.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),n=n.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),0==e)return"0";var o=0;"-"==n[0]&&(n=n.substring(1),o++),"-"==e[0]&&(e=e.substring(1),o++);var u=n.indexOf(".")>0?n.length-n.indexOf(".")-1:-1;if(n=(0,r.trim)(n.replace(".","")),u>=0){var a=e.indexOf(".")>0?e.length-e.indexOf(".")-1:-1;if(-1==a)e=(0,r.trim)(e+new Array(u+1).join("0"));else if(u>a)e=e.replace(".",""),e=(0,r.trim)(e+new Array(u-a+1).join("0"));else if(u<a){var s=(e=e.replace(".","")).length-a+u;e=(0,r.trim)(e.substring(0,s)+"."+e.substring(s))}else u==a&&(e=(0,r.trim)(e.replace(".","")))}var d=0,l=n.length,f="",g=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(0,l+1):e.substring(0,l);if(e=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(l+1):e.substring(l),g.indexOf(".")>-1){var v=g.length-g.indexOf(".")-1;l>(g=g.replace(".","")).length&&(v+=l-g.length,g+=new Array(l-g.length+1).join("0")),d=v,f="0."+new Array(v).join("0")}for(t+=2;d<=t;){for(var c=0;parseInt(g)>=parseInt(n);)g=(0,r.add)(g,"-"+n),c++;f+=c,e?("."==e[0]&&(f+=".",d++,e=e.substring(1)),g+=e.substring(0,1),e=e.substring(1)):(d||(f+="."),d++,g+="0")}return(1==o?"-":"")+(0,r.trim)((0,i.roundOff)(f,t-2))}},213:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.modulus=void 0;var r=t(415),i=t(350),o=t(182),u=t(26),a=t(916);function s(e){if(-1!=e.indexOf("."))throw new Error("Modulus of non-integers not supported")}n.modulus=function(e,n){if(0==n)throw new Error("Cannot divide by 0");e=e.toString(),n=n.toString(),s(e),s(n);var t="";return"-"==e[0]&&(t="-",e=e.substr(1)),"-"==n[0]&&(n=n.substr(1)),t+(0,u.subtract)(e,(0,o.multiply)(n,(0,i.roundOff)((0,r.divide)(e,n),0,a.RoundingModes.FLOOR)))}},182:function(e,n){function t(e){for(;"0"==e[0];)e=e.substr(1);if(-1!=e.indexOf("."))for(;"0"==e[e.length-1];)e=e.substr(0,e.length-1);return""==e||"."==e?e="0":"."==e[e.length-1]&&(e=e.substr(0,e.length-1)),"."==e[0]&&(e="0"+e),e}Object.defineProperty(n,"__esModule",{value:!0}),n.multiply=void 0,n.multiply=function(e,n){e=e.toString(),n=n.toString();var r=0;"-"==e[0]&&(r++,e=e.substr(1)),"-"==n[0]&&(r++,n=n.substr(1)),e=t(e),n=t(n);var i=0,o=0;-1!=e.indexOf(".")&&(i=e.length-e.indexOf(".")-1),-1!=n.indexOf(".")&&(o=n.length-n.indexOf(".")-1);var u=i+o;if(e=t(e.replace(".","")),n=t(n.replace(".","")),e.length<n.length){var a=e;e=n,n=a}if("0"==n)return"0";for(var s,d,l=n.length,f=0,g=[],v=l-1,c="",p=0;p<l;p++)g[p]=e.length-1;for(p=0;p<2*e.length;p++){for(var h=0,b=n.length-1;b>=v&&b>=0;b--)g[b]>-1&&g[b]<e.length&&(h+=parseInt(e[g[b]--])*parseInt(n[b]));h+=f,f=Math.floor(h/10),c=h%10+c,v--}return c=t((s=c,0==(d=u)?s:(s=d>=s.length?new Array(d-s.length+1).join("0")+s:s).substr(0,s.length-d)+"."+s.substr(s.length-d,d))),1==r&&(c="-"+c),c}},350:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.roundOff=void 0;var r=t(916);function i(e,n,t,i){if(!e||e===new Array(e.length+1).join("0"))return!1;if(i===r.RoundingModes.DOWN||!t&&i===r.RoundingModes.FLOOR||t&&i===r.RoundingModes.CEILING)return!1;if(i===r.RoundingModes.UP||t&&i===r.RoundingModes.FLOOR||!t&&i===r.RoundingModes.CEILING)return!0;var o="5"+new Array(e.length).join("0");if(e>o)return!0;if(e<o)return!1;switch(i){case r.RoundingModes.HALF_DOWN:return!1;case r.RoundingModes.HALF_UP:return!0;case r.RoundingModes.HALF_EVEN:default:return parseInt(n[n.length-1])%2==1}}function o(e,n){void 0===n&&(n=0),n||(n=1),"number"==typeof e&&e.toString();for(var t="",r=e.length-1;r>=0;r--){var i=parseInt(e[r])+n;10==i?(n=1,i=0):n=0,t+=i}return n&&(t+=n),t.split("").reverse().join("")}n.roundOff=function e(n,t,u){if(void 0===t&&(t=0),void 0===u&&(u=r.RoundingModes.HALF_EVEN),u===r.RoundingModes.UNNECESSARY)throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");"number"!=typeof n&&"bigint"!=typeof n||(n=n.toString());var a=!1;"-"===n[0]&&(a=!0,n=n.substring(1));var s=n.split("."),d=s[0],l=s[1];if(t<0){if(t=-t,d.length<=t)return"0";var f=d.substr(0,d.length-t);return(a?"-":"")+(f=e(n=f+"."+d.substr(d.length-t)+l,0,u))+new Array(t+1).join("0")}if(0==t){d.length;return i(s[1],d,a,u)&&(d=o(d)),(a&&parseInt(d)?"-":"")+d}if(!s[1])return(a?"-":"")+d+"."+new Array(t+1).join("0");if(s[1].length<t)return(a?"-":"")+d+"."+s[1]+new Array(t-s[1].length+1).join("0");l=s[1].substring(0,t);var g=s[1].substring(t);return g&&i(g,l,a,u)&&(l=o(l)).length>t?(a?"-":"")+o(d,parseInt(l[0]))+"."+l.substring(1):(a&&(parseInt(d)||parseInt(l))?"-":"")+d+"."+l}},916:function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.RoundingModes=void 0,function(e){e[e.CEILING=0]="CEILING",e[e.DOWN=1]="DOWN",e[e.FLOOR=2]="FLOOR",e[e.HALF_DOWN=3]="HALF_DOWN",e[e.HALF_EVEN=4]="HALF_EVEN",e[e.HALF_UP=5]="HALF_UP",e[e.UNNECESSARY=6]="UNNECESSARY",e[e.UP=7]="UP"}(n.RoundingModes||(n.RoundingModes={}))},26:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.negate=n.subtract=void 0;var r=t(217);function i(e){return e="-"==e[0]?e.substr(1):"-"+e}n.subtract=function(e,n){return e=e.toString(),n=i(n=n.toString()),(0,r.add)(e,n)},n.negate=i}},n={};var t=function t(r){var i=n[r];if(void 0!==i)return i.exports;var o=n[r]={exports:{}};return e[r](o,o.exports,t),o.exports}(423);return t}()}));
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.bigDecimal=n():e.bigDecimal=n()}(global,(function(){return function(){"use strict";var e={165:function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.abs=void 0,n.abs=function(e){return"number"!=typeof e&&"bigint"!=typeof e||(e=e.toString()),"-"==e[0]?e.substring(1):e}},217:function(e,n){function t(e){if(u(e))return e;for(var n="",t=e.length,r=e.split(".")[1],i=r?r.length:0,a=0;a<t;a++)e[a]>="0"&&e[a]<="9"?n+=9-parseInt(e[a]):n+=e[a];return o(n,i>0?"0."+new Array(i).join("0")+"1":"1")}function r(e){var n=e.split(".");for(n[0]||(n[0]="0");"0"==n[0][0]&&n[0].length>1;)n[0]=n[0].substring(1);return n[0]+(n[1]?"."+n[1]:"")}function i(e,n){var t=e.split("."),r=n.split("."),i=t[0].length,o=r[0].length;return i>o?r[0]=new Array(Math.abs(i-o)+1).join("0")+(r[0]?r[0]:""):t[0]=new Array(Math.abs(i-o)+1).join("0")+(t[0]?t[0]:""),i=t[1]?t[1].length:0,o=r[1]?r[1].length:0,(i||o)&&(i>o?r[1]=(r[1]?r[1]:"")+new Array(Math.abs(i-o)+1).join("0"):t[1]=(t[1]?t[1]:"")+new Array(Math.abs(i-o)+1).join("0")),[e=t[0]+(t[1]?"."+t[1]:""),n=r[0]+(r[1]?"."+r[1]:"")]}function o(e,n){var t;e=(t=i(e,n))[0],n=t[1];for(var r="",o=0,u=e.length-1;u>=0;u--)if("."!==e[u]){var a=parseInt(e[u])+parseInt(n[u])+o;r=a%10+r,o=Math.floor(a/10)}else r="."+r;return o?o.toString()+r:r}function u(e){return/^0[0]*[.]{0,1}[0]*$/.test(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.pad=n.trim=n.add=void 0,n.add=function(e,n){var a;void 0===n&&(n="0");var s=0,d=-1;"-"==e[0]&&(u(e=e.substring(1))||(s++,d=1,e.length)),"-"==n[0]&&(u(n=n.substring(1))||(s++,d=2,n.length)),e=r(e),n=r(n),e=(a=i(r(e),r(n)))[0],n=a[1],1==s&&(1===d?e=t(e):2===d&&(n=t(n)));var l=o(e,n);return s?2==s?"-"+r(l):e.length<l.length?r(l.substring(1)):"-"+r(t(l)):r(l)},n.trim=r,n.pad=i},664:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.compareTo=void 0;var r=t(217);n.compareTo=function(e,n){var t,i=!1;if("-"==e[0]&&"-"!=n[0])return-1;if("-"!=e[0]&&"-"==n[0])return 1;if("-"==e[0]&&"-"==n[0]&&(e=e.substr(1),n=n.substr(1),i=!0),e=(t=(0,r.pad)(e,n))[0],n=t[1],0==e.localeCompare(n))return 0;for(var o=0;o<e.length;o++)if(e[o]!=n[o])return e[o]>n[o]?i?-1:1:i?1:-1;return 0}},415:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.divide=void 0;var r=t(217),i=t(350);n.divide=function(e,n,t){if(void 0===t&&(t=8),0==n)throw new Error("Cannot divide by 0");if(e=e.toString(),n=n.toString(),e=e.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),n=n.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),0==e)return"0";var o=0;"-"==n[0]&&(n=n.substring(1),o++),"-"==e[0]&&(e=e.substring(1),o++);var u=n.indexOf(".")>0?n.length-n.indexOf(".")-1:-1;if(n=(0,r.trim)(n.replace(".","")),u>=0){var a=e.indexOf(".")>0?e.length-e.indexOf(".")-1:-1;if(-1==a)e=(0,r.trim)(e+new Array(u+1).join("0"));else if(u>a)e=e.replace(".",""),e=(0,r.trim)(e+new Array(u-a+1).join("0"));else if(u<a){var s=(e=e.replace(".","")).length-a+u;e=(0,r.trim)(e.substring(0,s)+"."+e.substring(s))}else u==a&&(e=(0,r.trim)(e.replace(".","")))}var d=0,l=n.length,f="",g=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(0,l+1):e.substring(0,l);if(e=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(l+1):e.substring(l),g.indexOf(".")>-1){var v=g.length-g.indexOf(".")-1;l>(g=g.replace(".","")).length&&(v+=l-g.length,g+=new Array(l-g.length+1).join("0")),d=v,f="0."+new Array(v).join("0")}for(t+=2;d<=t;){for(var c=0;parseInt(g)>=parseInt(n);)g=(0,r.add)(g,"-"+n),c++;f+=c,e?("."==e[0]&&(f+=".",d++,e=e.substring(1)),g+=e.substring(0,1),e=e.substring(1)):(d||(f+="."),d++,g+="0")}return(1==o?"-":"")+(0,r.trim)((0,i.roundOff)(f,t-2))}},213:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.modulus=void 0;var r=t(415),i=t(350),o=t(182),u=t(26),a=t(916);function s(e){if(-1!=e.indexOf("."))throw new Error("Modulus of non-integers not supported")}n.modulus=function(e,n){if(0==n)throw new Error("Cannot divide by 0");e=e.toString(),n=n.toString(),s(e),s(n);var t="";return"-"==e[0]&&(t="-",e=e.substr(1)),"-"==n[0]&&(n=n.substr(1)),t+(0,u.subtract)(e,(0,o.multiply)(n,(0,i.roundOff)((0,r.divide)(e,n),0,a.RoundingModes.FLOOR)))}},182:function(e,n){function t(e){for(;"0"==e[0];)e=e.substr(1);if(-1!=e.indexOf("."))for(;"0"==e[e.length-1];)e=e.substr(0,e.length-1);return""==e||"."==e?e="0":"."==e[e.length-1]&&(e=e.substr(0,e.length-1)),"."==e[0]&&(e="0"+e),e}Object.defineProperty(n,"__esModule",{value:!0}),n.multiply=void 0,n.multiply=function(e,n){e=e.toString(),n=n.toString();var r=0;"-"==e[0]&&(r++,e=e.substr(1)),"-"==n[0]&&(r++,n=n.substr(1)),e=t(e),n=t(n);var i=0,o=0;-1!=e.indexOf(".")&&(i=e.length-e.indexOf(".")-1),-1!=n.indexOf(".")&&(o=n.length-n.indexOf(".")-1);var u=i+o;if(e=t(e.replace(".","")),n=t(n.replace(".","")),e.length<n.length){var a=e;e=n,n=a}if("0"==n)return"0";for(var s,d,l=n.length,f=0,g=[],v=l-1,c="",p=0;p<l;p++)g[p]=e.length-1;for(p=0;p<2*e.length;p++){for(var h=0,b=n.length-1;b>=v&&b>=0;b--)g[b]>-1&&g[b]<e.length&&(h+=parseInt(e[g[b]--])*parseInt(n[b]));h+=f,f=Math.floor(h/10),c=h%10+c,v--}return c=t((s=c,0==(d=u)?s:(s=d>=s.length?new Array(d-s.length+1).join("0")+s:s).substr(0,s.length-d)+"."+s.substr(s.length-d,d))),1==r&&(c="-"+c),c}},350:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.roundOff=void 0;var r=t(916);function i(e,n,t,i){if(!e||e===new Array(e.length+1).join("0"))return!1;if(i===r.RoundingModes.DOWN||!t&&i===r.RoundingModes.FLOOR||t&&i===r.RoundingModes.CEILING)return!1;if(i===r.RoundingModes.UP||t&&i===r.RoundingModes.FLOOR||!t&&i===r.RoundingModes.CEILING)return!0;var o="5"+new Array(e.length).join("0");if(e>o)return!0;if(e<o)return!1;switch(i){case r.RoundingModes.HALF_DOWN:return!1;case r.RoundingModes.HALF_UP:return!0;case r.RoundingModes.HALF_EVEN:default:return parseInt(n[n.length-1])%2==1}}function o(e,n){void 0===n&&(n=0),n||(n=1),"number"==typeof e&&e.toString();for(var t="",r=e.length-1;r>=0;r--){var i=parseInt(e[r])+n;10==i?(n=1,i=0):n=0,t+=i}return n&&(t+=n),t.split("").reverse().join("")}n.roundOff=function e(n,t,u){if(void 0===t&&(t=0),void 0===u&&(u=r.RoundingModes.HALF_EVEN),u===r.RoundingModes.UNNECESSARY)throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");"number"!=typeof n&&"bigint"!=typeof n||(n=n.toString());var a=!1;"-"===n[0]&&(a=!0,n=n.substring(1));var s=n.split("."),d=s[0],l=s[1];if(t<0){if(t=-t,d.length<=t)return"0";var f=d.substr(0,d.length-t);return(a?"-":"")+(f=e(n=f+"."+d.substr(d.length-t)+l,0,u))+new Array(t+1).join("0")}if(0==t){d.length;return i(s[1],d,a,u)&&(d=o(d)),(a&&parseInt(d)?"-":"")+d}if(!s[1])return(a?"-":"")+d+"."+new Array(t+1).join("0");if(s[1].length<t)return(a?"-":"")+d+"."+s[1]+new Array(t-s[1].length+1).join("0");l=s[1].substring(0,t);var g=s[1].substring(t);return g&&i(g,l,a,u)&&(l=o(l)).length>t?(a?"-":"")+o(d,parseInt(l[0]))+"."+l.substring(1):(a&&(parseInt(d)||parseInt(l))?"-":"")+d+"."+l}},916:function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.RoundingModes=void 0,function(e){e[e.CEILING=0]="CEILING",e[e.DOWN=1]="DOWN",e[e.FLOOR=2]="FLOOR",e[e.HALF_DOWN=3]="HALF_DOWN",e[e.HALF_EVEN=4]="HALF_EVEN",e[e.HALF_UP=5]="HALF_UP",e[e.UNNECESSARY=6]="UNNECESSARY",e[e.UP=7]="UP"}(n.RoundingModes||(n.RoundingModes={}))},26:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.negate=n.subtract=void 0;var r=t(217);function i(e){return e="-"==e[0]?e.substr(1):"-"+e}n.subtract=function(e,n){return e=e.toString(),n=i(n=n.toString()),(0,r.add)(e,n)},n.negate=i}},n={};function t(r){var i=n[r];if(void 0!==i)return i.exports;var o=n[r]={exports:{}};return e[r](o,o.exports,t),o.exports}var r={};return function(){var e=r;Object.defineProperty(e,"__esModule",{value:!0});var n=t(217),i=t(165),o=t(350),u=t(182),a=t(415),s=t(213),d=t(664),l=t(26),f=t(916),g=function(){function e(n){void 0===n&&(n="0"),this.value=e.validate(n)}return e.validate=function(e){if(e){if(e=e.toString(),isNaN(e))throw Error("Parameter is not a number: "+e);"+"==e[0]&&(e=e.substring(1))}else e="0";if(e.startsWith(".")?e="0"+e:e.startsWith("-.")&&(e="-0"+e.substr(1)),/e/i.test(e)){var t=e.split(/[eE]/),r=t[0],i=t[1],o="";"-"==(r=(0,n.trim)(r))[0]&&(o="-",r=r.substring(1)),r.indexOf(".")>=0?(i=parseInt(i)+r.indexOf("."),r=r.replace(".","")):i=parseInt(i)+r.length,e=r.length<i?o+r+new Array(i-r.length+1).join("0"):r.length>=i&&i>0?o+(0,n.trim)(r.substring(0,i))+(r.length>i?"."+r.substring(i):""):o+"0."+new Array(1-i).join("0")+r}return e},e.prototype.getValue=function(){return this.value},e.prototype.setValue=function(n){this.value=e.validate(n)},e.getPrettyValue=function(n,t,r){void 0===t&&(t=3),void 0===r&&(r=",");var i="-"==(n=e.validate(n)).charAt(0);i&&(n=n.substring(1));for(var o=n.indexOf("."),u="",a=o=o>0?o:n.length;a>0;)a<t?(t=a,a=0):a-=t,u=n.substring(a,a+t)+(a<o-t&&a>=0?r:"")+u;return(i?"-":"")+u+n.substring(o)},e.prototype.getPrettyValue=function(n,t){return void 0===n&&(n=3),void 0===t&&(t=","),e.getPrettyValue(this.value,n,t)},e.round=function(n,t,r){if(void 0===t&&(t=0),void 0===r&&(r=f.RoundingModes.HALF_EVEN),n=e.validate(n),isNaN(t))throw Error("Precision is not a number: "+t);return(0,o.roundOff)(n,t,r)},e.prototype.round=function(n,t){if(void 0===n&&(n=0),void 0===t&&(t=f.RoundingModes.HALF_EVEN),isNaN(n))throw Error("Precision is not a number: "+n);return new e((0,o.roundOff)(this.value,n,t))},e.abs=function(n){return n=e.validate(n),(0,i.abs)(n)},e.prototype.abs=function(){return new e((0,i.abs)(this.value))},e.floor=function(n){return-1===(n=e.validate(n)).indexOf(".")?n:e.round(n,0,f.RoundingModes.FLOOR)},e.prototype.floor=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,f.RoundingModes.FLOOR)},e.ceil=function(n){return-1===(n=e.validate(n)).indexOf(".")?n:e.round(n,0,f.RoundingModes.CEILING)},e.prototype.ceil=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,f.RoundingModes.CEILING)},e.add=function(t,r){return t=e.validate(t),r=e.validate(r),(0,n.add)(t,r)},e.prototype.add=function(t){return new e((0,n.add)(this.value,t.getValue()))},e.subtract=function(n,t){return n=e.validate(n),t=e.validate(t),(0,l.subtract)(n,t)},e.prototype.subtract=function(n){return new e((0,l.subtract)(this.value,n.getValue()))},e.multiply=function(n,t){return n=e.validate(n),t=e.validate(t),(0,u.multiply)(n,t)},e.prototype.multiply=function(n){return new e((0,u.multiply)(this.value,n.getValue()))},e.divide=function(n,t,r){return n=e.validate(n),t=e.validate(t),(0,a.divide)(n,t,r)},e.prototype.divide=function(n,t){return new e((0,a.divide)(this.value,n.getValue(),t))},e.modulus=function(n,t){return n=e.validate(n),t=e.validate(t),(0,s.modulus)(n,t)},e.prototype.modulus=function(n){return new e((0,s.modulus)(this.value,n.getValue()))},e.compareTo=function(n,t){return n=e.validate(n),t=e.validate(t),(0,d.compareTo)(n,t)},e.prototype.compareTo=function(e){return(0,d.compareTo)(this.value,e.getValue())},e.negate=function(n){return n=e.validate(n),(0,l.negate)(n)},e.prototype.negate=function(){return new e((0,l.negate)(this.value))},e.RoundingModes=f.RoundingModes,e}();e.default=g}(),r}()}));

@@ -13,5 +13,5 @@ var bigDecimal;

function abs(n) {
if (typeof n == 'number' || typeof n == 'bigint')
if (typeof n == "number" || typeof n == "bigint")
n = n.toString();
if (n[0] == '-')
if (n[0] == "-")
return n.substring(1);

@@ -37,3 +37,3 @@ return n;

//check for negatives
if (number1[0] == '-') {
if (number1[0] == "-") {
number1 = number1.substring(1);

@@ -46,3 +46,3 @@ if (!testZero(number1)) {

}
if (number2[0] == '-') {
if (number2[0] == "-") {
number2 = number2.substring(1);

@@ -68,8 +68,8 @@ if (!testZero(number2)) {

else if (neg == 2)
return ('-' + trim(res));
return "-" + trim(res);
else {
if (number1.length < (res.length))
if (number1.length < res.length)
return trim(res.substring(1));
else
return ('-' + trim(compliment(res)));
return "-" + trim(compliment(res));
}

@@ -82,44 +82,52 @@ }

}
var s = '', l = number.length, dec = number.split('.')[1], ld = dec ? dec.length : 0;
var s = "", l = number.length, dec = number.split(".")[1], ld = dec ? dec.length : 0;
for (var i = 0; i < l; i++) {
if (number[i] >= '0' && number[i] <= '9')
s += (9 - parseInt(number[i]));
if (number[i] >= "0" && number[i] <= "9")
s += 9 - parseInt(number[i]);
else
s += number[i];
}
var one = (ld > 0) ? ('0.' + (new Array(ld)).join('0') + '1') : '1';
var one = ld > 0 ? "0." + new Array(ld).join("0") + "1" : "1";
return addCore(s, one);
}
function trim(number) {
var parts = number.split('.');
var parts = number.split(".");
if (!parts[0])
parts[0] = '0';
while (parts[0][0] == '0' && parts[0].length > 1)
parts[0] = "0";
while (parts[0][0] == "0" && parts[0].length > 1)
parts[0] = parts[0].substring(1);
return parts[0] + (parts[1] ? ('.' + parts[1]) : '');
return parts[0] + (parts[1] ? "." + parts[1] : "");
}
exports.trim = trim;
function pad(number1, number2) {
var parts1 = number1.split('.'), parts2 = number2.split('.');
var parts1 = number1.split("."), parts2 = number2.split(".");
//pad integral part
var length1 = parts1[0].length, length2 = parts2[0].length;
if (length1 > length2) {
parts2[0] = (new Array(Math.abs(length1 - length2) + 1)).join('0') + (parts2[0] ? parts2[0] : '');
parts2[0] =
new Array(Math.abs(length1 - length2) + 1).join("0") +
(parts2[0] ? parts2[0] : "");
}
else {
parts1[0] = (new Array(Math.abs(length1 - length2) + 1)).join('0') + (parts1[0] ? parts1[0] : '');
parts1[0] =
new Array(Math.abs(length1 - length2) + 1).join("0") +
(parts1[0] ? parts1[0] : "");
}
//pad fractional part
length1 = parts1[1] ? parts1[1].length : 0,
length2 = parts2[1] ? parts2[1].length : 0;
(length1 = parts1[1] ? parts1[1].length : 0),
(length2 = parts2[1] ? parts2[1].length : 0);
if (length1 || length2) {
if (length1 > length2) {
parts2[1] = (parts2[1] ? parts2[1] : '') + (new Array(Math.abs(length1 - length2) + 1)).join('0');
parts2[1] =
(parts2[1] ? parts2[1] : "") +
new Array(Math.abs(length1 - length2) + 1).join("0");
}
else {
parts1[1] = (parts1[1] ? parts1[1] : '') + (new Array(Math.abs(length1 - length2) + 1)).join('0');
parts1[1] =
(parts1[1] ? parts1[1] : "") +
new Array(Math.abs(length1 - length2) + 1).join("0");
}
}
number1 = parts1[0] + ((parts1[1]) ? ('.' + parts1[1]) : '');
number2 = parts2[0] + ((parts2[1]) ? ('.' + parts2[1]) : '');
number1 = parts1[0] + (parts1[1] ? "." + parts1[1] : "");
number2 = parts2[0] + (parts2[1] ? "." + parts2[1] : "");
return [number1, number2];

@@ -131,6 +139,6 @@ }

_a = pad(number1, number2), number1 = _a[0], number2 = _a[1];
var sum = '', carry = 0;
var sum = "", carry = 0;
for (var i = number1.length - 1; i >= 0; i--) {
if (number1[i] === '.') {
sum = '.' + sum;
if (number1[i] === ".") {
sum = "." + sum;
continue;

@@ -142,6 +150,6 @@ }

}
return carry ? (carry.toString() + sum) : sum;
return carry ? carry.toString() + sum : sum;
}
function testZero(number) {
return (/^0[0]*[.]{0,1}[0]*$/.test(number));
return /^0[0]*[.]{0,1}[0]*$/.test(number);
}

@@ -152,207 +160,2 @@

/***/ 423:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var add_1 = __webpack_require__(217);
var abs_1 = __webpack_require__(165);
var round_1 = __webpack_require__(350);
var multiply_1 = __webpack_require__(182);
var divide_1 = __webpack_require__(415);
var modulus_1 = __webpack_require__(213);
var compareTo_1 = __webpack_require__(664);
var subtract_1 = __webpack_require__(26);
var roundingModes_1 = __webpack_require__(916);
var bigDecimal = /** @class */ (function () {
function bigDecimal(number) {
if (number === void 0) { number = '0'; }
this.value = bigDecimal.validate(number);
}
bigDecimal.validate = function (number) {
if (number) {
number = number.toString();
if (isNaN(number))
throw Error("Parameter is not a number: " + number);
if (number[0] == '+')
number = number.substring(1);
}
else
number = '0';
//handle missing leading zero
if (number.startsWith('.'))
number = '0' + number;
else if (number.startsWith('-.'))
number = '-0' + number.substr(1);
//handle exponentiation
if (/e/i.test(number)) {
var _a = number.split(/[eE]/), mantisa = _a[0], exponent = _a[1];
mantisa = (0, add_1.trim)(mantisa);
var sign = '';
if (mantisa[0] == '-') {
sign = '-';
mantisa = mantisa.substring(1);
}
if (mantisa.indexOf('.') >= 0) {
exponent = parseInt(exponent) + mantisa.indexOf('.');
mantisa = mantisa.replace('.', '');
}
else {
exponent = parseInt(exponent) + mantisa.length;
}
if (mantisa.length < exponent) {
number = sign + mantisa + (new Array(exponent - mantisa.length + 1)).join('0');
}
else if (mantisa.length >= exponent && exponent > 0) {
number = sign + (0, add_1.trim)(mantisa.substring(0, exponent)) +
((mantisa.length > exponent) ? ('.' + mantisa.substring(exponent)) : '');
}
else {
number = sign + '0.' + (new Array(-exponent + 1)).join('0') + mantisa;
}
}
return number;
};
bigDecimal.prototype.getValue = function () {
return this.value;
};
bigDecimal.prototype.setValue = function (num) {
this.value = bigDecimal.validate(num);
};
bigDecimal.getPrettyValue = function (number, digits, separator) {
if (!(digits || separator)) {
digits = 3;
separator = ',';
}
else if (!(digits && separator)) {
throw Error('Illegal Arguments. Should pass both digits and separator or pass none');
}
number = bigDecimal.validate(number);
var neg = number.charAt(0) == '-';
if (neg)
number = number.substring(1);
var len = number.indexOf('.');
len = len > 0 ? len : (number.length);
var temp = '';
for (var i = len; i > 0;) {
if (i < digits) {
digits = i;
i = 0;
}
else
i -= digits;
temp = number.substring(i, i + digits) + ((i < (len - digits) && i >= 0) ? separator : '') + temp;
}
return (neg ? '-' : '') + temp + number.substring(len);
};
bigDecimal.prototype.getPrettyValue = function (digits, separator) {
return bigDecimal.getPrettyValue(this.value, digits, separator);
};
bigDecimal.round = function (number, precision, mode) {
if (precision === void 0) { precision = 0; }
if (mode === void 0) { mode = roundingModes_1.RoundingModes.HALF_EVEN; }
number = bigDecimal.validate(number);
// console.log(number)
if (isNaN(precision))
throw Error("Precision is not a number: " + precision);
return (0, round_1.roundOff)(number, precision, mode);
};
bigDecimal.prototype.round = function (precision, mode) {
if (precision === void 0) { precision = 0; }
if (mode === void 0) { mode = roundingModes_1.RoundingModes.HALF_EVEN; }
if (isNaN(precision))
throw Error("Precision is not a number: " + precision);
return new bigDecimal((0, round_1.roundOff)(this.value, precision, mode));
};
bigDecimal.abs = function (number) {
number = bigDecimal.validate(number);
return (0, abs_1.abs)(number);
};
bigDecimal.prototype.abs = function () {
return new bigDecimal((0, abs_1.abs)(this.value));
};
bigDecimal.floor = function (number) {
number = bigDecimal.validate(number);
if (number.indexOf('.') === -1)
return number;
return bigDecimal.round(number, 0, roundingModes_1.RoundingModes.FLOOR);
};
bigDecimal.prototype.floor = function () {
if (this.value.indexOf('.') === -1)
return new bigDecimal(this.value);
return new bigDecimal(this.value).round(0, roundingModes_1.RoundingModes.FLOOR);
};
bigDecimal.ceil = function (number) {
number = bigDecimal.validate(number);
if (number.indexOf('.') === -1)
return number;
return bigDecimal.round(number, 0, roundingModes_1.RoundingModes.CEILING);
};
bigDecimal.prototype.ceil = function () {
if (this.value.indexOf('.') === -1)
return new bigDecimal(this.value);
return new bigDecimal(this.value).round(0, roundingModes_1.RoundingModes.CEILING);
};
bigDecimal.add = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, add_1.add)(number1, number2);
};
bigDecimal.prototype.add = function (number) {
return new bigDecimal((0, add_1.add)(this.value, number.getValue()));
};
bigDecimal.subtract = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, subtract_1.subtract)(number1, number2);
};
bigDecimal.prototype.subtract = function (number) {
return new bigDecimal((0, subtract_1.subtract)(this.value, number.getValue()));
};
bigDecimal.multiply = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, multiply_1.multiply)(number1, number2);
};
bigDecimal.prototype.multiply = function (number) {
return new bigDecimal((0, multiply_1.multiply)(this.value, number.getValue()));
};
bigDecimal.divide = function (number1, number2, precision) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, divide_1.divide)(number1, number2, precision);
};
bigDecimal.prototype.divide = function (number, precision) {
return new bigDecimal((0, divide_1.divide)(this.value, number.getValue(), precision));
};
bigDecimal.modulus = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, modulus_1.modulus)(number1, number2);
};
bigDecimal.prototype.modulus = function (number) {
return new bigDecimal((0, modulus_1.modulus)(this.value, number.getValue()));
};
bigDecimal.compareTo = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, compareTo_1.compareTo)(number1, number2);
};
bigDecimal.prototype.compareTo = function (number) {
return (0, compareTo_1.compareTo)(this.value, number.getValue());
};
bigDecimal.negate = function (number) {
number = bigDecimal.validate(number);
return (0, subtract_1.negate)(number);
};
bigDecimal.prototype.negate = function () {
return new bigDecimal((0, subtract_1.negate)(this.value));
};
bigDecimal.RoundingModes = roundingModes_1.RoundingModes;
return bigDecimal;
}());
module.exports = bigDecimal;
/***/ }),
/***/ 664:

@@ -876,10 +679,218 @@ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {

/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __webpack_require__(423);
/******/ bigDecimal = __webpack_exports__;
/******/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
var exports = __webpack_exports__;
Object.defineProperty(exports, "__esModule", ({ value: true }));
var add_1 = __webpack_require__(217);
var abs_1 = __webpack_require__(165);
var round_1 = __webpack_require__(350);
var multiply_1 = __webpack_require__(182);
var divide_1 = __webpack_require__(415);
var modulus_1 = __webpack_require__(213);
var compareTo_1 = __webpack_require__(664);
var subtract_1 = __webpack_require__(26);
var roundingModes_1 = __webpack_require__(916);
var bigDecimal = /** @class */ (function () {
function bigDecimal(number) {
if (number === void 0) { number = "0"; }
this.value = bigDecimal.validate(number);
}
bigDecimal.validate = function (number) {
if (number) {
number = number.toString();
if (isNaN(number))
throw Error("Parameter is not a number: " + number);
if (number[0] == "+")
number = number.substring(1);
}
else
number = "0";
//handle missing leading zero
if (number.startsWith("."))
number = "0" + number;
else if (number.startsWith("-."))
number = "-0" + number.substr(1);
//handle exponentiation
if (/e/i.test(number)) {
var _a = number.split(/[eE]/), mantisa = _a[0], exponent = _a[1];
mantisa = (0, add_1.trim)(mantisa);
var sign = "";
if (mantisa[0] == "-") {
sign = "-";
mantisa = mantisa.substring(1);
}
if (mantisa.indexOf(".") >= 0) {
exponent = parseInt(exponent) + mantisa.indexOf(".");
mantisa = mantisa.replace(".", "");
}
else {
exponent = parseInt(exponent) + mantisa.length;
}
if (mantisa.length < exponent) {
number =
sign + mantisa + new Array(exponent - mantisa.length + 1).join("0");
}
else if (mantisa.length >= exponent && exponent > 0) {
number =
sign +
(0, add_1.trim)(mantisa.substring(0, exponent)) +
(mantisa.length > exponent ? "." + mantisa.substring(exponent) : "");
}
else {
number = sign + "0." + new Array(-exponent + 1).join("0") + mantisa;
}
}
return number;
};
bigDecimal.prototype.getValue = function () {
return this.value;
};
bigDecimal.prototype.setValue = function (num) {
this.value = bigDecimal.validate(num);
};
bigDecimal.getPrettyValue = function (number, digits, separator) {
if (digits === void 0) { digits = 3; }
if (separator === void 0) { separator = ","; }
// if (!(digits || separator)) {
// digits = 3;
// separator = ',';
// } else if (!(digits && separator)) {
// throw Error('Illegal Arguments. Should pass both digits and separator or pass none');
// }
number = bigDecimal.validate(number);
var neg = number.charAt(0) == "-";
if (neg)
number = number.substring(1);
var len = number.indexOf(".");
len = len > 0 ? len : number.length;
var temp = "";
for (var i = len; i > 0;) {
if (i < digits) {
digits = i;
i = 0;
}
else
i -= digits;
temp =
number.substring(i, i + digits) +
(i < len - digits && i >= 0 ? separator : "") +
temp;
}
return (neg ? "-" : "") + temp + number.substring(len);
};
bigDecimal.prototype.getPrettyValue = function (digits, separator) {
if (digits === void 0) { digits = 3; }
if (separator === void 0) { separator = ","; }
return bigDecimal.getPrettyValue(this.value, digits, separator);
};
bigDecimal.round = function (number, precision, mode) {
if (precision === void 0) { precision = 0; }
if (mode === void 0) { mode = roundingModes_1.RoundingModes.HALF_EVEN; }
number = bigDecimal.validate(number);
// console.log(number)
if (isNaN(precision))
throw Error("Precision is not a number: " + precision);
return (0, round_1.roundOff)(number, precision, mode);
};
bigDecimal.prototype.round = function (precision, mode) {
if (precision === void 0) { precision = 0; }
if (mode === void 0) { mode = roundingModes_1.RoundingModes.HALF_EVEN; }
if (isNaN(precision))
throw Error("Precision is not a number: " + precision);
return new bigDecimal((0, round_1.roundOff)(this.value, precision, mode));
};
bigDecimal.abs = function (number) {
number = bigDecimal.validate(number);
return (0, abs_1.abs)(number);
};
bigDecimal.prototype.abs = function () {
return new bigDecimal((0, abs_1.abs)(this.value));
};
bigDecimal.floor = function (number) {
number = bigDecimal.validate(number);
if (number.indexOf(".") === -1)
return number;
return bigDecimal.round(number, 0, roundingModes_1.RoundingModes.FLOOR);
};
bigDecimal.prototype.floor = function () {
if (this.value.indexOf(".") === -1)
return new bigDecimal(this.value);
return new bigDecimal(this.value).round(0, roundingModes_1.RoundingModes.FLOOR);
};
bigDecimal.ceil = function (number) {
number = bigDecimal.validate(number);
if (number.indexOf(".") === -1)
return number;
return bigDecimal.round(number, 0, roundingModes_1.RoundingModes.CEILING);
};
bigDecimal.prototype.ceil = function () {
if (this.value.indexOf(".") === -1)
return new bigDecimal(this.value);
return new bigDecimal(this.value).round(0, roundingModes_1.RoundingModes.CEILING);
};
bigDecimal.add = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, add_1.add)(number1, number2);
};
bigDecimal.prototype.add = function (number) {
return new bigDecimal((0, add_1.add)(this.value, number.getValue()));
};
bigDecimal.subtract = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, subtract_1.subtract)(number1, number2);
};
bigDecimal.prototype.subtract = function (number) {
return new bigDecimal((0, subtract_1.subtract)(this.value, number.getValue()));
};
bigDecimal.multiply = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, multiply_1.multiply)(number1, number2);
};
bigDecimal.prototype.multiply = function (number) {
return new bigDecimal((0, multiply_1.multiply)(this.value, number.getValue()));
};
bigDecimal.divide = function (number1, number2, precision) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, divide_1.divide)(number1, number2, precision);
};
bigDecimal.prototype.divide = function (number, precision) {
return new bigDecimal((0, divide_1.divide)(this.value, number.getValue(), precision));
};
bigDecimal.modulus = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, modulus_1.modulus)(number1, number2);
};
bigDecimal.prototype.modulus = function (number) {
return new bigDecimal((0, modulus_1.modulus)(this.value, number.getValue()));
};
bigDecimal.compareTo = function (number1, number2) {
number1 = bigDecimal.validate(number1);
number2 = bigDecimal.validate(number2);
return (0, compareTo_1.compareTo)(number1, number2);
};
bigDecimal.prototype.compareTo = function (number) {
return (0, compareTo_1.compareTo)(this.value, number.getValue());
};
bigDecimal.negate = function (number) {
number = bigDecimal.validate(number);
return (0, subtract_1.negate)(number);
};
bigDecimal.prototype.negate = function () {
return new bigDecimal((0, subtract_1.negate)(this.value));
};
bigDecimal.RoundingModes = roundingModes_1.RoundingModes;
return bigDecimal;
}());
exports["default"] = bigDecimal;
}();
bigDecimal = __webpack_exports__;
/******/ })()
;

@@ -1,1 +0,1 @@

var bigDecimal;!function(){"use strict";var n={165:function(n,e){Object.defineProperty(e,"__esModule",{value:!0}),e.abs=void 0,e.abs=function(n){return"number"!=typeof n&&"bigint"!=typeof n||(n=n.toString()),"-"==n[0]?n.substring(1):n}},217:function(n,e){function t(n){if(u(n))return n;for(var e="",t=n.length,r=n.split(".")[1],i=r?r.length:0,a=0;a<t;a++)n[a]>="0"&&n[a]<="9"?e+=9-parseInt(n[a]):e+=n[a];return o(e,i>0?"0."+new Array(i).join("0")+"1":"1")}function r(n){var e=n.split(".");for(e[0]||(e[0]="0");"0"==e[0][0]&&e[0].length>1;)e[0]=e[0].substring(1);return e[0]+(e[1]?"."+e[1]:"")}function i(n,e){var t=n.split("."),r=e.split("."),i=t[0].length,o=r[0].length;return i>o?r[0]=new Array(Math.abs(i-o)+1).join("0")+(r[0]?r[0]:""):t[0]=new Array(Math.abs(i-o)+1).join("0")+(t[0]?t[0]:""),i=t[1]?t[1].length:0,o=r[1]?r[1].length:0,(i||o)&&(i>o?r[1]=(r[1]?r[1]:"")+new Array(Math.abs(i-o)+1).join("0"):t[1]=(t[1]?t[1]:"")+new Array(Math.abs(i-o)+1).join("0")),[n=t[0]+(t[1]?"."+t[1]:""),e=r[0]+(r[1]?"."+r[1]:"")]}function o(n,e){var t;n=(t=i(n,e))[0],e=t[1];for(var r="",o=0,u=n.length-1;u>=0;u--)if("."!==n[u]){var a=parseInt(n[u])+parseInt(e[u])+o;r=a%10+r,o=Math.floor(a/10)}else r="."+r;return o?o.toString()+r:r}function u(n){return/^0[0]*[.]{0,1}[0]*$/.test(n)}Object.defineProperty(e,"__esModule",{value:!0}),e.pad=e.trim=e.add=void 0,e.add=function(n,e){var a;void 0===e&&(e="0");var s=0,d=-1;"-"==n[0]&&(u(n=n.substring(1))||(s++,d=1,n.length)),"-"==e[0]&&(u(e=e.substring(1))||(s++,d=2,e.length)),n=r(n),e=r(e),n=(a=i(r(n),r(e)))[0],e=a[1],1==s&&(1===d?n=t(n):2===d&&(e=t(e)));var l=o(n,e);return s?2==s?"-"+r(l):n.length<l.length?r(l.substring(1)):"-"+r(t(l)):r(l)},e.trim=r,e.pad=i},423:function(n,e,t){var r=t(217),i=t(165),o=t(350),u=t(182),a=t(415),s=t(213),d=t(664),l=t(26),f=t(916),g=function(){function n(e){void 0===e&&(e="0"),this.value=n.validate(e)}return n.validate=function(n){if(n){if(n=n.toString(),isNaN(n))throw Error("Parameter is not a number: "+n);"+"==n[0]&&(n=n.substring(1))}else n="0";if(n.startsWith(".")?n="0"+n:n.startsWith("-.")&&(n="-0"+n.substr(1)),/e/i.test(n)){var e=n.split(/[eE]/),t=e[0],i=e[1],o="";"-"==(t=(0,r.trim)(t))[0]&&(o="-",t=t.substring(1)),t.indexOf(".")>=0?(i=parseInt(i)+t.indexOf("."),t=t.replace(".","")):i=parseInt(i)+t.length,n=t.length<i?o+t+new Array(i-t.length+1).join("0"):t.length>=i&&i>0?o+(0,r.trim)(t.substring(0,i))+(t.length>i?"."+t.substring(i):""):o+"0."+new Array(1-i).join("0")+t}return n},n.prototype.getValue=function(){return this.value},n.prototype.setValue=function(e){this.value=n.validate(e)},n.getPrettyValue=function(e,t,r){if(t||r){if(!t||!r)throw Error("Illegal Arguments. Should pass both digits and separator or pass none")}else t=3,r=",";var i="-"==(e=n.validate(e)).charAt(0);i&&(e=e.substring(1));for(var o=e.indexOf("."),u="",a=o=o>0?o:e.length;a>0;)a<t?(t=a,a=0):a-=t,u=e.substring(a,a+t)+(a<o-t&&a>=0?r:"")+u;return(i?"-":"")+u+e.substring(o)},n.prototype.getPrettyValue=function(e,t){return n.getPrettyValue(this.value,e,t)},n.round=function(e,t,r){if(void 0===t&&(t=0),void 0===r&&(r=f.RoundingModes.HALF_EVEN),e=n.validate(e),isNaN(t))throw Error("Precision is not a number: "+t);return(0,o.roundOff)(e,t,r)},n.prototype.round=function(e,t){if(void 0===e&&(e=0),void 0===t&&(t=f.RoundingModes.HALF_EVEN),isNaN(e))throw Error("Precision is not a number: "+e);return new n((0,o.roundOff)(this.value,e,t))},n.abs=function(e){return e=n.validate(e),(0,i.abs)(e)},n.prototype.abs=function(){return new n((0,i.abs)(this.value))},n.floor=function(e){return-1===(e=n.validate(e)).indexOf(".")?e:n.round(e,0,f.RoundingModes.FLOOR)},n.prototype.floor=function(){return-1===this.value.indexOf(".")?new n(this.value):new n(this.value).round(0,f.RoundingModes.FLOOR)},n.ceil=function(e){return-1===(e=n.validate(e)).indexOf(".")?e:n.round(e,0,f.RoundingModes.CEILING)},n.prototype.ceil=function(){return-1===this.value.indexOf(".")?new n(this.value):new n(this.value).round(0,f.RoundingModes.CEILING)},n.add=function(e,t){return e=n.validate(e),t=n.validate(t),(0,r.add)(e,t)},n.prototype.add=function(e){return new n((0,r.add)(this.value,e.getValue()))},n.subtract=function(e,t){return e=n.validate(e),t=n.validate(t),(0,l.subtract)(e,t)},n.prototype.subtract=function(e){return new n((0,l.subtract)(this.value,e.getValue()))},n.multiply=function(e,t){return e=n.validate(e),t=n.validate(t),(0,u.multiply)(e,t)},n.prototype.multiply=function(e){return new n((0,u.multiply)(this.value,e.getValue()))},n.divide=function(e,t,r){return e=n.validate(e),t=n.validate(t),(0,a.divide)(e,t,r)},n.prototype.divide=function(e,t){return new n((0,a.divide)(this.value,e.getValue(),t))},n.modulus=function(e,t){return e=n.validate(e),t=n.validate(t),(0,s.modulus)(e,t)},n.prototype.modulus=function(e){return new n((0,s.modulus)(this.value,e.getValue()))},n.compareTo=function(e,t){return e=n.validate(e),t=n.validate(t),(0,d.compareTo)(e,t)},n.prototype.compareTo=function(n){return(0,d.compareTo)(this.value,n.getValue())},n.negate=function(e){return e=n.validate(e),(0,l.negate)(e)},n.prototype.negate=function(){return new n((0,l.negate)(this.value))},n.RoundingModes=f.RoundingModes,n}();n.exports=g},664:function(n,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.compareTo=void 0;var r=t(217);e.compareTo=function(n,e){var t,i=!1;if("-"==n[0]&&"-"!=e[0])return-1;if("-"!=n[0]&&"-"==e[0])return 1;if("-"==n[0]&&"-"==e[0]&&(n=n.substr(1),e=e.substr(1),i=!0),n=(t=(0,r.pad)(n,e))[0],e=t[1],0==n.localeCompare(e))return 0;for(var o=0;o<n.length;o++)if(n[o]!=e[o])return n[o]>e[o]?i?-1:1:i?1:-1;return 0}},415:function(n,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.divide=void 0;var r=t(217),i=t(350);e.divide=function(n,e,t){if(void 0===t&&(t=8),0==e)throw new Error("Cannot divide by 0");if(n=n.toString(),e=e.toString(),n=n.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),e=e.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),0==n)return"0";var o=0;"-"==e[0]&&(e=e.substring(1),o++),"-"==n[0]&&(n=n.substring(1),o++);var u=e.indexOf(".")>0?e.length-e.indexOf(".")-1:-1;if(e=(0,r.trim)(e.replace(".","")),u>=0){var a=n.indexOf(".")>0?n.length-n.indexOf(".")-1:-1;if(-1==a)n=(0,r.trim)(n+new Array(u+1).join("0"));else if(u>a)n=n.replace(".",""),n=(0,r.trim)(n+new Array(u-a+1).join("0"));else if(u<a){var s=(n=n.replace(".","")).length-a+u;n=(0,r.trim)(n.substring(0,s)+"."+n.substring(s))}else u==a&&(n=(0,r.trim)(n.replace(".","")))}var d=0,l=e.length,f="",g=n.indexOf(".")>-1&&n.indexOf(".")<l?n.substring(0,l+1):n.substring(0,l);if(n=n.indexOf(".")>-1&&n.indexOf(".")<l?n.substring(l+1):n.substring(l),g.indexOf(".")>-1){var v=g.length-g.indexOf(".")-1;l>(g=g.replace(".","")).length&&(v+=l-g.length,g+=new Array(l-g.length+1).join("0")),d=v,f="0."+new Array(v).join("0")}for(t+=2;d<=t;){for(var c=0;parseInt(g)>=parseInt(e);)g=(0,r.add)(g,"-"+e),c++;f+=c,n?("."==n[0]&&(f+=".",d++,n=n.substring(1)),g+=n.substring(0,1),n=n.substring(1)):(d||(f+="."),d++,g+="0")}return(1==o?"-":"")+(0,r.trim)((0,i.roundOff)(f,t-2))}},213:function(n,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.modulus=void 0;var r=t(415),i=t(350),o=t(182),u=t(26),a=t(916);function s(n){if(-1!=n.indexOf("."))throw new Error("Modulus of non-integers not supported")}e.modulus=function(n,e){if(0==e)throw new Error("Cannot divide by 0");n=n.toString(),e=e.toString(),s(n),s(e);var t="";return"-"==n[0]&&(t="-",n=n.substr(1)),"-"==e[0]&&(e=e.substr(1)),t+(0,u.subtract)(n,(0,o.multiply)(e,(0,i.roundOff)((0,r.divide)(n,e),0,a.RoundingModes.FLOOR)))}},182:function(n,e){function t(n){for(;"0"==n[0];)n=n.substr(1);if(-1!=n.indexOf("."))for(;"0"==n[n.length-1];)n=n.substr(0,n.length-1);return""==n||"."==n?n="0":"."==n[n.length-1]&&(n=n.substr(0,n.length-1)),"."==n[0]&&(n="0"+n),n}Object.defineProperty(e,"__esModule",{value:!0}),e.multiply=void 0,e.multiply=function(n,e){n=n.toString(),e=e.toString();var r=0;"-"==n[0]&&(r++,n=n.substr(1)),"-"==e[0]&&(r++,e=e.substr(1)),n=t(n),e=t(e);var i=0,o=0;-1!=n.indexOf(".")&&(i=n.length-n.indexOf(".")-1),-1!=e.indexOf(".")&&(o=e.length-e.indexOf(".")-1);var u=i+o;if(n=t(n.replace(".","")),e=t(e.replace(".","")),n.length<e.length){var a=n;n=e,e=a}if("0"==e)return"0";for(var s,d,l=e.length,f=0,g=[],v=l-1,c="",p=0;p<l;p++)g[p]=n.length-1;for(p=0;p<2*n.length;p++){for(var h=0,b=e.length-1;b>=v&&b>=0;b--)g[b]>-1&&g[b]<n.length&&(h+=parseInt(n[g[b]--])*parseInt(e[b]));h+=f,f=Math.floor(h/10),c=h%10+c,v--}return c=t((s=c,0==(d=u)?s:(s=d>=s.length?new Array(d-s.length+1).join("0")+s:s).substr(0,s.length-d)+"."+s.substr(s.length-d,d))),1==r&&(c="-"+c),c}},350:function(n,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.roundOff=void 0;var r=t(916);function i(n,e,t,i){if(!n||n===new Array(n.length+1).join("0"))return!1;if(i===r.RoundingModes.DOWN||!t&&i===r.RoundingModes.FLOOR||t&&i===r.RoundingModes.CEILING)return!1;if(i===r.RoundingModes.UP||t&&i===r.RoundingModes.FLOOR||!t&&i===r.RoundingModes.CEILING)return!0;var o="5"+new Array(n.length).join("0");if(n>o)return!0;if(n<o)return!1;switch(i){case r.RoundingModes.HALF_DOWN:return!1;case r.RoundingModes.HALF_UP:return!0;case r.RoundingModes.HALF_EVEN:default:return parseInt(e[e.length-1])%2==1}}function o(n,e){void 0===e&&(e=0),e||(e=1),"number"==typeof n&&n.toString();for(var t="",r=n.length-1;r>=0;r--){var i=parseInt(n[r])+e;10==i?(e=1,i=0):e=0,t+=i}return e&&(t+=e),t.split("").reverse().join("")}e.roundOff=function n(e,t,u){if(void 0===t&&(t=0),void 0===u&&(u=r.RoundingModes.HALF_EVEN),u===r.RoundingModes.UNNECESSARY)throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");"number"!=typeof e&&"bigint"!=typeof e||(e=e.toString());var a=!1;"-"===e[0]&&(a=!0,e=e.substring(1));var s=e.split("."),d=s[0],l=s[1];if(t<0){if(t=-t,d.length<=t)return"0";var f=d.substr(0,d.length-t);return(a?"-":"")+(f=n(e=f+"."+d.substr(d.length-t)+l,0,u))+new Array(t+1).join("0")}if(0==t){d.length;return i(s[1],d,a,u)&&(d=o(d)),(a&&parseInt(d)?"-":"")+d}if(!s[1])return(a?"-":"")+d+"."+new Array(t+1).join("0");if(s[1].length<t)return(a?"-":"")+d+"."+s[1]+new Array(t-s[1].length+1).join("0");l=s[1].substring(0,t);var g=s[1].substring(t);return g&&i(g,l,a,u)&&(l=o(l)).length>t?(a?"-":"")+o(d,parseInt(l[0]))+"."+l.substring(1):(a&&(parseInt(d)||parseInt(l))?"-":"")+d+"."+l}},916:function(n,e){Object.defineProperty(e,"__esModule",{value:!0}),e.RoundingModes=void 0,function(n){n[n.CEILING=0]="CEILING",n[n.DOWN=1]="DOWN",n[n.FLOOR=2]="FLOOR",n[n.HALF_DOWN=3]="HALF_DOWN",n[n.HALF_EVEN=4]="HALF_EVEN",n[n.HALF_UP=5]="HALF_UP",n[n.UNNECESSARY=6]="UNNECESSARY",n[n.UP=7]="UP"}(e.RoundingModes||(e.RoundingModes={}))},26:function(n,e,t){Object.defineProperty(e,"__esModule",{value:!0}),e.negate=e.subtract=void 0;var r=t(217);function i(n){return n="-"==n[0]?n.substr(1):"-"+n}e.subtract=function(n,e){return n=n.toString(),e=i(e=e.toString()),(0,r.add)(n,e)},e.negate=i}},e={};var t=function t(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return n[r](o,o.exports,t),o.exports}(423);bigDecimal=t}();
var bigDecimal;!function(){"use strict";var e={165:function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.abs=void 0,n.abs=function(e){return"number"!=typeof e&&"bigint"!=typeof e||(e=e.toString()),"-"==e[0]?e.substring(1):e}},217:function(e,n){function t(e){if(u(e))return e;for(var n="",t=e.length,r=e.split(".")[1],i=r?r.length:0,a=0;a<t;a++)e[a]>="0"&&e[a]<="9"?n+=9-parseInt(e[a]):n+=e[a];return o(n,i>0?"0."+new Array(i).join("0")+"1":"1")}function r(e){var n=e.split(".");for(n[0]||(n[0]="0");"0"==n[0][0]&&n[0].length>1;)n[0]=n[0].substring(1);return n[0]+(n[1]?"."+n[1]:"")}function i(e,n){var t=e.split("."),r=n.split("."),i=t[0].length,o=r[0].length;return i>o?r[0]=new Array(Math.abs(i-o)+1).join("0")+(r[0]?r[0]:""):t[0]=new Array(Math.abs(i-o)+1).join("0")+(t[0]?t[0]:""),i=t[1]?t[1].length:0,o=r[1]?r[1].length:0,(i||o)&&(i>o?r[1]=(r[1]?r[1]:"")+new Array(Math.abs(i-o)+1).join("0"):t[1]=(t[1]?t[1]:"")+new Array(Math.abs(i-o)+1).join("0")),[e=t[0]+(t[1]?"."+t[1]:""),n=r[0]+(r[1]?"."+r[1]:"")]}function o(e,n){var t;e=(t=i(e,n))[0],n=t[1];for(var r="",o=0,u=e.length-1;u>=0;u--)if("."!==e[u]){var a=parseInt(e[u])+parseInt(n[u])+o;r=a%10+r,o=Math.floor(a/10)}else r="."+r;return o?o.toString()+r:r}function u(e){return/^0[0]*[.]{0,1}[0]*$/.test(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.pad=n.trim=n.add=void 0,n.add=function(e,n){var a;void 0===n&&(n="0");var s=0,d=-1;"-"==e[0]&&(u(e=e.substring(1))||(s++,d=1,e.length)),"-"==n[0]&&(u(n=n.substring(1))||(s++,d=2,n.length)),e=r(e),n=r(n),e=(a=i(r(e),r(n)))[0],n=a[1],1==s&&(1===d?e=t(e):2===d&&(n=t(n)));var l=o(e,n);return s?2==s?"-"+r(l):e.length<l.length?r(l.substring(1)):"-"+r(t(l)):r(l)},n.trim=r,n.pad=i},664:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.compareTo=void 0;var r=t(217);n.compareTo=function(e,n){var t,i=!1;if("-"==e[0]&&"-"!=n[0])return-1;if("-"!=e[0]&&"-"==n[0])return 1;if("-"==e[0]&&"-"==n[0]&&(e=e.substr(1),n=n.substr(1),i=!0),e=(t=(0,r.pad)(e,n))[0],n=t[1],0==e.localeCompare(n))return 0;for(var o=0;o<e.length;o++)if(e[o]!=n[o])return e[o]>n[o]?i?-1:1:i?1:-1;return 0}},415:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.divide=void 0;var r=t(217),i=t(350);n.divide=function(e,n,t){if(void 0===t&&(t=8),0==n)throw new Error("Cannot divide by 0");if(e=e.toString(),n=n.toString(),e=e.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),n=n.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,""),0==e)return"0";var o=0;"-"==n[0]&&(n=n.substring(1),o++),"-"==e[0]&&(e=e.substring(1),o++);var u=n.indexOf(".")>0?n.length-n.indexOf(".")-1:-1;if(n=(0,r.trim)(n.replace(".","")),u>=0){var a=e.indexOf(".")>0?e.length-e.indexOf(".")-1:-1;if(-1==a)e=(0,r.trim)(e+new Array(u+1).join("0"));else if(u>a)e=e.replace(".",""),e=(0,r.trim)(e+new Array(u-a+1).join("0"));else if(u<a){var s=(e=e.replace(".","")).length-a+u;e=(0,r.trim)(e.substring(0,s)+"."+e.substring(s))}else u==a&&(e=(0,r.trim)(e.replace(".","")))}var d=0,l=n.length,f="",g=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(0,l+1):e.substring(0,l);if(e=e.indexOf(".")>-1&&e.indexOf(".")<l?e.substring(l+1):e.substring(l),g.indexOf(".")>-1){var v=g.length-g.indexOf(".")-1;l>(g=g.replace(".","")).length&&(v+=l-g.length,g+=new Array(l-g.length+1).join("0")),d=v,f="0."+new Array(v).join("0")}for(t+=2;d<=t;){for(var c=0;parseInt(g)>=parseInt(n);)g=(0,r.add)(g,"-"+n),c++;f+=c,e?("."==e[0]&&(f+=".",d++,e=e.substring(1)),g+=e.substring(0,1),e=e.substring(1)):(d||(f+="."),d++,g+="0")}return(1==o?"-":"")+(0,r.trim)((0,i.roundOff)(f,t-2))}},213:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.modulus=void 0;var r=t(415),i=t(350),o=t(182),u=t(26),a=t(916);function s(e){if(-1!=e.indexOf("."))throw new Error("Modulus of non-integers not supported")}n.modulus=function(e,n){if(0==n)throw new Error("Cannot divide by 0");e=e.toString(),n=n.toString(),s(e),s(n);var t="";return"-"==e[0]&&(t="-",e=e.substr(1)),"-"==n[0]&&(n=n.substr(1)),t+(0,u.subtract)(e,(0,o.multiply)(n,(0,i.roundOff)((0,r.divide)(e,n),0,a.RoundingModes.FLOOR)))}},182:function(e,n){function t(e){for(;"0"==e[0];)e=e.substr(1);if(-1!=e.indexOf("."))for(;"0"==e[e.length-1];)e=e.substr(0,e.length-1);return""==e||"."==e?e="0":"."==e[e.length-1]&&(e=e.substr(0,e.length-1)),"."==e[0]&&(e="0"+e),e}Object.defineProperty(n,"__esModule",{value:!0}),n.multiply=void 0,n.multiply=function(e,n){e=e.toString(),n=n.toString();var r=0;"-"==e[0]&&(r++,e=e.substr(1)),"-"==n[0]&&(r++,n=n.substr(1)),e=t(e),n=t(n);var i=0,o=0;-1!=e.indexOf(".")&&(i=e.length-e.indexOf(".")-1),-1!=n.indexOf(".")&&(o=n.length-n.indexOf(".")-1);var u=i+o;if(e=t(e.replace(".","")),n=t(n.replace(".","")),e.length<n.length){var a=e;e=n,n=a}if("0"==n)return"0";for(var s,d,l=n.length,f=0,g=[],v=l-1,c="",p=0;p<l;p++)g[p]=e.length-1;for(p=0;p<2*e.length;p++){for(var h=0,b=n.length-1;b>=v&&b>=0;b--)g[b]>-1&&g[b]<e.length&&(h+=parseInt(e[g[b]--])*parseInt(n[b]));h+=f,f=Math.floor(h/10),c=h%10+c,v--}return c=t((s=c,0==(d=u)?s:(s=d>=s.length?new Array(d-s.length+1).join("0")+s:s).substr(0,s.length-d)+"."+s.substr(s.length-d,d))),1==r&&(c="-"+c),c}},350:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.roundOff=void 0;var r=t(916);function i(e,n,t,i){if(!e||e===new Array(e.length+1).join("0"))return!1;if(i===r.RoundingModes.DOWN||!t&&i===r.RoundingModes.FLOOR||t&&i===r.RoundingModes.CEILING)return!1;if(i===r.RoundingModes.UP||t&&i===r.RoundingModes.FLOOR||!t&&i===r.RoundingModes.CEILING)return!0;var o="5"+new Array(e.length).join("0");if(e>o)return!0;if(e<o)return!1;switch(i){case r.RoundingModes.HALF_DOWN:return!1;case r.RoundingModes.HALF_UP:return!0;case r.RoundingModes.HALF_EVEN:default:return parseInt(n[n.length-1])%2==1}}function o(e,n){void 0===n&&(n=0),n||(n=1),"number"==typeof e&&e.toString();for(var t="",r=e.length-1;r>=0;r--){var i=parseInt(e[r])+n;10==i?(n=1,i=0):n=0,t+=i}return n&&(t+=n),t.split("").reverse().join("")}n.roundOff=function e(n,t,u){if(void 0===t&&(t=0),void 0===u&&(u=r.RoundingModes.HALF_EVEN),u===r.RoundingModes.UNNECESSARY)throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");"number"!=typeof n&&"bigint"!=typeof n||(n=n.toString());var a=!1;"-"===n[0]&&(a=!0,n=n.substring(1));var s=n.split("."),d=s[0],l=s[1];if(t<0){if(t=-t,d.length<=t)return"0";var f=d.substr(0,d.length-t);return(a?"-":"")+(f=e(n=f+"."+d.substr(d.length-t)+l,0,u))+new Array(t+1).join("0")}if(0==t){d.length;return i(s[1],d,a,u)&&(d=o(d)),(a&&parseInt(d)?"-":"")+d}if(!s[1])return(a?"-":"")+d+"."+new Array(t+1).join("0");if(s[1].length<t)return(a?"-":"")+d+"."+s[1]+new Array(t-s[1].length+1).join("0");l=s[1].substring(0,t);var g=s[1].substring(t);return g&&i(g,l,a,u)&&(l=o(l)).length>t?(a?"-":"")+o(d,parseInt(l[0]))+"."+l.substring(1):(a&&(parseInt(d)||parseInt(l))?"-":"")+d+"."+l}},916:function(e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.RoundingModes=void 0,function(e){e[e.CEILING=0]="CEILING",e[e.DOWN=1]="DOWN",e[e.FLOOR=2]="FLOOR",e[e.HALF_DOWN=3]="HALF_DOWN",e[e.HALF_EVEN=4]="HALF_EVEN",e[e.HALF_UP=5]="HALF_UP",e[e.UNNECESSARY=6]="UNNECESSARY",e[e.UP=7]="UP"}(n.RoundingModes||(n.RoundingModes={}))},26:function(e,n,t){Object.defineProperty(n,"__esModule",{value:!0}),n.negate=n.subtract=void 0;var r=t(217);function i(e){return e="-"==e[0]?e.substr(1):"-"+e}n.subtract=function(e,n){return e=e.toString(),n=i(n=n.toString()),(0,r.add)(e,n)},n.negate=i}},n={};function t(r){var i=n[r];if(void 0!==i)return i.exports;var o=n[r]={exports:{}};return e[r](o,o.exports,t),o.exports}var r={};!function(){var e=r;Object.defineProperty(e,"__esModule",{value:!0});var n=t(217),i=t(165),o=t(350),u=t(182),a=t(415),s=t(213),d=t(664),l=t(26),f=t(916),g=function(){function e(n){void 0===n&&(n="0"),this.value=e.validate(n)}return e.validate=function(e){if(e){if(e=e.toString(),isNaN(e))throw Error("Parameter is not a number: "+e);"+"==e[0]&&(e=e.substring(1))}else e="0";if(e.startsWith(".")?e="0"+e:e.startsWith("-.")&&(e="-0"+e.substr(1)),/e/i.test(e)){var t=e.split(/[eE]/),r=t[0],i=t[1],o="";"-"==(r=(0,n.trim)(r))[0]&&(o="-",r=r.substring(1)),r.indexOf(".")>=0?(i=parseInt(i)+r.indexOf("."),r=r.replace(".","")):i=parseInt(i)+r.length,e=r.length<i?o+r+new Array(i-r.length+1).join("0"):r.length>=i&&i>0?o+(0,n.trim)(r.substring(0,i))+(r.length>i?"."+r.substring(i):""):o+"0."+new Array(1-i).join("0")+r}return e},e.prototype.getValue=function(){return this.value},e.prototype.setValue=function(n){this.value=e.validate(n)},e.getPrettyValue=function(n,t,r){void 0===t&&(t=3),void 0===r&&(r=",");var i="-"==(n=e.validate(n)).charAt(0);i&&(n=n.substring(1));for(var o=n.indexOf("."),u="",a=o=o>0?o:n.length;a>0;)a<t?(t=a,a=0):a-=t,u=n.substring(a,a+t)+(a<o-t&&a>=0?r:"")+u;return(i?"-":"")+u+n.substring(o)},e.prototype.getPrettyValue=function(n,t){return void 0===n&&(n=3),void 0===t&&(t=","),e.getPrettyValue(this.value,n,t)},e.round=function(n,t,r){if(void 0===t&&(t=0),void 0===r&&(r=f.RoundingModes.HALF_EVEN),n=e.validate(n),isNaN(t))throw Error("Precision is not a number: "+t);return(0,o.roundOff)(n,t,r)},e.prototype.round=function(n,t){if(void 0===n&&(n=0),void 0===t&&(t=f.RoundingModes.HALF_EVEN),isNaN(n))throw Error("Precision is not a number: "+n);return new e((0,o.roundOff)(this.value,n,t))},e.abs=function(n){return n=e.validate(n),(0,i.abs)(n)},e.prototype.abs=function(){return new e((0,i.abs)(this.value))},e.floor=function(n){return-1===(n=e.validate(n)).indexOf(".")?n:e.round(n,0,f.RoundingModes.FLOOR)},e.prototype.floor=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,f.RoundingModes.FLOOR)},e.ceil=function(n){return-1===(n=e.validate(n)).indexOf(".")?n:e.round(n,0,f.RoundingModes.CEILING)},e.prototype.ceil=function(){return-1===this.value.indexOf(".")?new e(this.value):new e(this.value).round(0,f.RoundingModes.CEILING)},e.add=function(t,r){return t=e.validate(t),r=e.validate(r),(0,n.add)(t,r)},e.prototype.add=function(t){return new e((0,n.add)(this.value,t.getValue()))},e.subtract=function(n,t){return n=e.validate(n),t=e.validate(t),(0,l.subtract)(n,t)},e.prototype.subtract=function(n){return new e((0,l.subtract)(this.value,n.getValue()))},e.multiply=function(n,t){return n=e.validate(n),t=e.validate(t),(0,u.multiply)(n,t)},e.prototype.multiply=function(n){return new e((0,u.multiply)(this.value,n.getValue()))},e.divide=function(n,t,r){return n=e.validate(n),t=e.validate(t),(0,a.divide)(n,t,r)},e.prototype.divide=function(n,t){return new e((0,a.divide)(this.value,n.getValue(),t))},e.modulus=function(n,t){return n=e.validate(n),t=e.validate(t),(0,s.modulus)(n,t)},e.prototype.modulus=function(n){return new e((0,s.modulus)(this.value,n.getValue()))},e.compareTo=function(n,t){return n=e.validate(n),t=e.validate(t),(0,d.compareTo)(n,t)},e.prototype.compareTo=function(e){return(0,d.compareTo)(this.value,e.getValue())},e.negate=function(n){return n=e.validate(n),(0,l.negate)(n)},e.prototype.negate=function(){return new e((0,l.negate)(this.value))},e.RoundingModes=f.RoundingModes,e}();e.default=g}(),bigDecimal=r}();
{
"name": "js-big-decimal",
"version": "1.4.1",
"description": "Work with large numbers on the client side. Round them off to any required precission.",
"version": "2.0.0",
"description": "Work with large numbers on the client side. Round them off to any required precision.",
"main": "dist/node/js-big-decimal",
"types": "dist/node/big-decimal",
"module": "dist/esm/big-decimal.js",
"scripts": {

@@ -49,2 +50,3 @@ "test": "ts-node node_modules/jasmine/bin/jasmine --config=spec/jasmine.json --helper=spec/helper/*.js",

"devDependencies": {
"@rollup/plugin-typescript": "^11.1.0",
"@types/jasmine": "^4.3.1",

@@ -64,4 +66,6 @@ "@types/node": "^18.11.18",

"nyc": "^15.1.0",
"rollup": "^3.21.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.4",
"tslib": "^2.5.0",
"typescript": "^4.9.5",
"webpack": "^5.75.0",

@@ -68,0 +72,0 @@ "webpack-cli": "^4.10.0"

@@ -62,8 +62,8 @@ # JS Big Decimal

Require in `javascript` as
```jsavascript
```javascript
var bigDecimal = require('js-big-decimal');
```
For `typescript`, use
```jsavascript
import bigDecimal require('js-big-decimal');
```javascript
import bigDecimal = require('js-big-decimal');
```

@@ -70,0 +70,0 @@ For `web`, when used with script tag, a variable on `Window` object is created.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc