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.2.0 to 1.2.1

dist/node/roundingModes.d.ts

657

dist/node/js-big-decimal.js

@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

root["bigDecimal"] = factory();
})(this, function() {
})(global, function() {
return /******/ (function(modules) { // webpackBootstrap

@@ -58,2 +58,7 @@ /******/ // The module cache

/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules

@@ -74,4 +79,5 @@ /******/ __webpack_require__.n = function(module) {

/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 3);
/******/ return __webpack_require__(__webpack_require__.s = 7);
/******/ })

@@ -196,3 +202,51 @@ /************************************************************************/

Object.defineProperty(exports, "__esModule", { value: true });
var roundingModes_1 = __webpack_require__(2);
var RoundingModes;
(function (RoundingModes) {
/**
* Rounding mode to round towards positive infinity.
*/
RoundingModes[RoundingModes["CEILING"] = 0] = "CEILING";
/**
* Rounding mode to round towards zero.
*/
RoundingModes[RoundingModes["DOWN"] = 1] = "DOWN";
/**
* Rounding mode to round towards negative infinity.
*/
RoundingModes[RoundingModes["FLOOR"] = 2] = "FLOOR";
/**
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
* in which case round down.
*/
RoundingModes[RoundingModes["HALF_DOWN"] = 3] = "HALF_DOWN";
/**
* Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant,
* in which case, round towards the even neighbor.
*/
RoundingModes[RoundingModes["HALF_EVEN"] = 4] = "HALF_EVEN";
/**
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
* in which case round up.
*/
RoundingModes[RoundingModes["HALF_UP"] = 5] = "HALF_UP";
/**
* Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.
* UNIMPLEMENTED
*/
RoundingModes[RoundingModes["UNNECESSARY"] = 6] = "UNNECESSARY";
/**
* Rounding mode to round away from zero.
*/
RoundingModes[RoundingModes["UP"] = 7] = "UP";
})(RoundingModes = exports.RoundingModes || (exports.RoundingModes = {}));
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var roundingModes_1 = __webpack_require__(1);
/**

@@ -306,3 +360,3 @@ *

/***/ }),
/* 2 */
/* 3 */
/***/ (function(module, exports, __webpack_require__) {

@@ -313,38 +367,24 @@

Object.defineProperty(exports, "__esModule", { value: true });
/**
* CEILING
* Rounding mode to round towards positive infinity.
* DOWN
* Rounding mode to round towards zero.
* FLOOR
* Rounding mode to round towards negative infinity.
* HALF_DOWN
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
* in which case round down.
* HALF_EVEN
* Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant,
* in which case, round towards the even neighbor.
* HALF_UP
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
* in which case round up.
* UNNECESSARY
* Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.
* UP
* Rounding mode to round away from zero.
*/
var RoundingModes;
(function (RoundingModes) {
RoundingModes[RoundingModes["CEILING"] = 0] = "CEILING";
RoundingModes[RoundingModes["DOWN"] = 1] = "DOWN";
RoundingModes[RoundingModes["FLOOR"] = 2] = "FLOOR";
RoundingModes[RoundingModes["HALF_DOWN"] = 3] = "HALF_DOWN";
RoundingModes[RoundingModes["HALF_EVEN"] = 4] = "HALF_EVEN";
RoundingModes[RoundingModes["HALF_UP"] = 5] = "HALF_UP";
RoundingModes[RoundingModes["UNNECESSARY"] = 6] = "UNNECESSARY";
RoundingModes[RoundingModes["UP"] = 7] = "UP";
})(RoundingModes = exports.RoundingModes || (exports.RoundingModes = {}));
var add_1 = __webpack_require__(0);
function subtract(number1, number2) {
number1 = number1.toString();
number2 = number2.toString();
number2 = negate(number2);
return add_1.add(number1, number2);
}
exports.subtract = subtract;
function negate(number) {
if (number[0] == '-') {
number = number.substr(1);
}
else {
number = '-' + number;
}
return number;
}
exports.negate = negate;
/***/ }),
/* 3 */
/* 4 */
/***/ (function(module, exports, __webpack_require__) {

@@ -354,10 +394,262 @@

Object.defineProperty(exports, "__esModule", { value: true });
var add_1 = __webpack_require__(0);
var round_1 = __webpack_require__(1);
var multiply_1 = __webpack_require__(4);
function compareTo(number1, number2) {
var negative = false;
if (number1[0] == '-' && number2[0] != "-") {
return -1;
}
else if (number1[0] != '-' && number2[0] == '-') {
return 1;
}
else if (number1[0] == '-' && number2[0] == '-') {
number1 = number1.substr(1);
number2 = number2.substr(1);
negative = true;
}
_a = add_1.pad(number1, number2), number1 = _a[0], number2 = _a[1];
if (number1.localeCompare(number2) == 0) {
return 0;
}
for (var i = 0; i < number1.length; i++) {
if (number1[i] == number2[i]) {
continue;
}
else if (number1[i] > number2[i]) {
if (negative) {
return -1;
}
else {
return 1;
}
}
else {
if (negative) {
return 1;
}
else {
return -1;
}
}
}
return 0;
var _a;
}
exports.compareTo = compareTo;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var add_1 = __webpack_require__(0);
var round_1 = __webpack_require__(2);
function divide(dividend, divisor, precission) {
if (precission === void 0) { precission = 8; }
if (divisor == 0) {
throw new Error('Cannot divide by 0');
}
dividend = dividend.toString();
divisor = divisor.toString();
if (dividend == 0)
return '0';
var neg = 0;
if (divisor[0] == '-') {
divisor = divisor.substring(1);
neg++;
}
if (dividend[0] == '-') {
dividend = dividend.substring(1);
neg++;
}
var pt_dvsr = divisor.indexOf('.') > 0 ? divisor.length - divisor.indexOf('.') - 1 : -1;
divisor = add_1.trim(divisor.replace('.', ''));
if (pt_dvsr >= 0) {
var pt_dvnd = dividend.indexOf('.') > 0 ? dividend.length - dividend.indexOf('.') - 1 : -1;
if (pt_dvnd == -1) {
dividend = add_1.trim(dividend + (new Array(pt_dvsr + 1)).join('0'));
}
else {
if (pt_dvsr > pt_dvnd) {
dividend = dividend.replace('.', '');
dividend = add_1.trim(dividend + (new Array(pt_dvsr - pt_dvnd + 1)).join('0'));
}
else if (pt_dvsr < pt_dvnd) {
dividend = dividend.replace('.', '');
var loc = dividend.length - pt_dvsr + pt_dvsr;
dividend = add_1.trim(dividend.substring(0, loc) + '.' + dividend.substring(loc));
}
else if (pt_dvsr == pt_dvnd) {
dividend = add_1.trim(dividend.replace('.', ''));
}
}
}
var prec = 0, dl = divisor.length, rem = '0', quotent = '';
var dvnd = (dividend.indexOf('.') > -1 && dividend.indexOf('.') < dl) ? dividend.substring(0, dl + 1) : dividend.substring(0, dl);
dividend = (dividend.indexOf('.') > -1 && dividend.indexOf('.') < dl) ? dividend.substring(dl + 1) : dividend.substring(dl);
if (dvnd.indexOf('.') > -1) {
var shift = dvnd.length - dvnd.indexOf('.') - 1;
dvnd = dvnd.replace('.', '');
if (dl > dvnd.length) {
shift += dl - dvnd.length;
dvnd = dvnd + (new Array(dl - dvnd.length + 1)).join('0');
}
prec = shift;
quotent = '0.' + (new Array(shift)).join('0');
}
precission = precission + 2;
while (prec <= precission) {
var qt = 0;
while (parseInt(dvnd) >= parseInt(divisor)) {
dvnd = add_1.add(dvnd, '-' + divisor);
qt++;
}
quotent += qt;
if (!dividend) {
if (!prec)
quotent += '.';
prec++;
dvnd = dvnd + '0';
}
else {
if (dividend[0] == '.') {
quotent += '.';
prec++;
dividend = dividend.substring(1);
}
dvnd = dvnd + dividend.substring(0, 1);
dividend = dividend.substring(1);
}
}
return ((neg == 1) ? '-' : '') + add_1.trim(round_1.roundOff(quotent, precission - 2));
}
exports.divide = divide;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function multiply(number1, number2) {
number1 = number1.toString();
number2 = number2.toString();
/*Filter numbers*/
var negative = 0;
if (number1[0] == '-') {
negative++;
number1 = number1.substr(1);
}
if (number2[0] == '-') {
negative++;
number2 = number2.substr(1);
}
number1 = trailZero(number1);
number2 = trailZero(number2);
var decimalLength1 = 0;
var decimalLength2 = 0;
if (number1.indexOf('.') != -1) {
decimalLength1 = number1.length - number1.indexOf('.') - 1;
}
if (number2.indexOf('.') != -1) {
decimalLength2 = number2.length - number2.indexOf('.') - 1;
}
var decimalLength = decimalLength1 + decimalLength2;
number1 = trailZero(number1.replace('.', ''));
number2 = trailZero(number2.replace('.', ''));
if (number1.length < number2.length) {
var temp = number1;
number1 = number2;
number2 = temp;
}
if (number2 == '0') {
return '0';
}
/*
* Core multiplication
*/
var length = number2.length;
var carry = 0;
var positionVector = [];
var currentPosition = length - 1;
var result = "";
for (var i = 0; i < length; i++) {
positionVector[i] = number1.length - 1;
}
for (var i = 0; i < 2 * number1.length; i++) {
var sum = 0;
for (var j = number2.length - 1; j >= currentPosition && j >= 0; j--) {
if (positionVector[j] > -1 && positionVector[j] < number1.length) {
sum += parseInt(number1[positionVector[j]--]) * parseInt(number2[j]);
}
}
sum += carry;
carry = Math.floor(sum / 10);
result = sum % 10 + result;
currentPosition--;
}
/*
* Formatting result
*/
result = trailZero(adjustDecimal(result, decimalLength));
if (negative == 1) {
result = '-' + result;
}
return result;
}
exports.multiply = multiply;
/*
* Add decimal point
*/
function adjustDecimal(number, decimal) {
if (decimal == 0)
return number;
else {
number = (decimal >= number.length) ? ((new Array(decimal - number.length + 1)).join('0') + number) : number;
return number.substr(0, number.length - decimal) + '.' + number.substr(number.length - decimal, decimal);
}
}
/*
* Removes zero from front and back*/
function trailZero(number) {
while (number[0] == '0') {
number = number.substr(1);
}
if (number.indexOf('.') != -1) {
while (number[number.length - 1] == '0') {
number = number.substr(0, number.length - 1);
}
}
if (number == "" || number == ".") {
number = '0';
}
else if (number[number.length - 1] == '.') {
number = number.substr(0, number.length - 1);
}
if (number[0] == '.') {
number = '0' + number;
}
return number;
}
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var add_1 = __webpack_require__(0);
var round_1 = __webpack_require__(2);
var multiply_1 = __webpack_require__(6);
var divide_1 = __webpack_require__(5);
var compareTo_1 = __webpack_require__(6);
var subtract_1 = __webpack_require__(7);
var roundingModes_1 = __webpack_require__(2);
var bigDecimal = (function () {
var compareTo_1 = __webpack_require__(4);
var subtract_1 = __webpack_require__(3);
var roundingModes_1 = __webpack_require__(1);
var bigDecimal = /** @class */ (function () {
function bigDecimal(number) {

@@ -518,283 +810,4 @@ if (number === void 0) { number = '0'; }

/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function multiply(number1, number2) {
number1 = number1.toString();
number2 = number2.toString();
/*Filter numbers*/
var negative = 0;
if (number1[0] == '-') {
negative++;
number1 = number1.substr(1);
}
if (number2[0] == '-') {
negative++;
number2 = number2.substr(1);
}
number1 = trailZero(number1);
number2 = trailZero(number2);
var decimalLength1 = 0;
var decimalLength2 = 0;
if (number1.indexOf('.') != -1) {
decimalLength1 = number1.length - number1.indexOf('.') - 1;
}
if (number2.indexOf('.') != -1) {
decimalLength2 = number2.length - number2.indexOf('.') - 1;
}
var decimalLength = decimalLength1 + decimalLength2;
number1 = trailZero(number1.replace('.', ''));
number2 = trailZero(number2.replace('.', ''));
if (number1.length < number2.length) {
var temp = number1;
number1 = number2;
number2 = temp;
}
if (number2 == '0') {
return '0';
}
/*
* Core multiplication
*/
var length = number2.length;
var carry = 0;
var positionVector = [];
var currentPosition = length - 1;
var result = "";
for (var i = 0; i < length; i++) {
positionVector[i] = number1.length - 1;
}
for (var i = 0; i < 2 * number1.length; i++) {
var sum = 0;
for (var j = number2.length - 1; j >= currentPosition && j >= 0; j--) {
if (positionVector[j] > -1 && positionVector[j] < number1.length) {
sum += parseInt(number1[positionVector[j]--]) * parseInt(number2[j]);
}
}
sum += carry;
carry = Math.floor(sum / 10);
result = sum % 10 + result;
currentPosition--;
}
/*
* Formatting result
*/
result = trailZero(adjustDecimal(result, decimalLength));
if (negative == 1) {
result = '-' + result;
}
return result;
}
exports.multiply = multiply;
/*
* Add decimal point
*/
function adjustDecimal(number, decimal) {
if (decimal == 0)
return number;
else {
number = (decimal >= number.length) ? ((new Array(decimal - number.length + 1)).join('0') + number) : number;
return number.substr(0, number.length - decimal) + '.' + number.substr(number.length - decimal, decimal);
}
}
/*
* Removes zero from front and back*/
function trailZero(number) {
while (number[0] == '0') {
number = number.substr(1);
}
if (number.indexOf('.') != -1) {
while (number[number.length - 1] == '0') {
number = number.substr(0, number.length - 1);
}
}
if (number == "" || number == ".") {
number = '0';
}
else if (number[number.length - 1] == '.') {
number = number.substr(0, number.length - 1);
}
if (number[0] == '.') {
number = '0' + number;
}
return number;
}
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var add_1 = __webpack_require__(0);
var round_1 = __webpack_require__(1);
function divide(dividend, divisor, precission) {
if (precission === void 0) { precission = 8; }
if (divisor == 0) {
throw new Error('Cannot divide by 0');
}
dividend = dividend.toString();
divisor = divisor.toString();
if (dividend == 0)
return '0';
var neg = 0;
if (divisor[0] == '-') {
divisor = divisor.substring(1);
neg++;
}
if (dividend[0] == '-') {
dividend = dividend.substring(1);
neg++;
}
var pt_dvsr = divisor.indexOf('.') > 0 ? divisor.length - divisor.indexOf('.') - 1 : -1;
divisor = add_1.trim(divisor.replace('.', ''));
if (pt_dvsr >= 0) {
var pt_dvnd = dividend.indexOf('.') > 0 ? dividend.length - dividend.indexOf('.') - 1 : -1;
if (pt_dvnd == -1) {
dividend = add_1.trim(dividend + (new Array(pt_dvsr + 1)).join('0'));
}
else {
if (pt_dvsr > pt_dvnd) {
dividend = dividend.replace('.', '');
dividend = add_1.trim(dividend + (new Array(pt_dvsr - pt_dvnd + 1)).join('0'));
}
else if (pt_dvsr < pt_dvnd) {
dividend = dividend.replace('.', '');
var loc = dividend.length - pt_dvsr + pt_dvsr;
dividend = add_1.trim(dividend.substring(0, loc) + '.' + dividend.substring(loc));
}
else if (pt_dvsr == pt_dvnd) {
dividend = add_1.trim(dividend.replace('.', ''));
}
}
}
var prec = 0, dl = divisor.length, rem = '0', quotent = '';
var dvnd = (dividend.indexOf('.') > -1 && dividend.indexOf('.') < dl) ? dividend.substring(0, dl + 1) : dividend.substring(0, dl);
dividend = (dividend.indexOf('.') > -1 && dividend.indexOf('.') < dl) ? dividend.substring(dl + 1) : dividend.substring(dl);
if (dvnd.indexOf('.') > -1) {
var shift = dvnd.length - dvnd.indexOf('.') - 1;
dvnd = dvnd.replace('.', '');
if (dl > dvnd.length) {
shift += dl - dvnd.length;
dvnd = dvnd + (new Array(dl - dvnd.length + 1)).join('0');
}
prec = shift;
quotent = '0.' + (new Array(shift)).join('0');
}
precission = precission + 2;
while (prec <= precission) {
var qt = 0;
while (parseInt(dvnd) >= parseInt(divisor)) {
dvnd = add_1.add(dvnd, '-' + divisor);
qt++;
}
quotent += qt;
if (!dividend) {
if (!prec)
quotent += '.';
prec++;
dvnd = dvnd + '0';
}
else {
if (dividend[0] == '.') {
quotent += '.';
prec++;
dividend = dividend.substring(1);
}
dvnd = dvnd + dividend.substring(0, 1);
dividend = dividend.substring(1);
}
}
return ((neg == 1) ? '-' : '') + add_1.trim(round_1.roundOff(quotent, precission - 2));
}
exports.divide = divide;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var add_1 = __webpack_require__(0);
function compareTo(number1, number2) {
var negative = false;
if (number1[0] == '-' && number2[0] != "-") {
return -1;
}
else if (number1[0] != '-' && number2[0] == '-') {
return 1;
}
else if (number1[0] == '-' && number2[0] == '-') {
number1 = number1.substr(1);
number2 = number2.substr(1);
negative = true;
}
_a = add_1.pad(number1, number2), number1 = _a[0], number2 = _a[1];
if (number1.localeCompare(number2) == 0) {
return 0;
}
for (var i = 0; i < number1.length; i++) {
if (number1[i] == number2[i]) {
continue;
}
else if (number1[i] > number2[i]) {
if (negative) {
return -1;
}
else {
return 1;
}
}
else {
if (negative) {
return 1;
}
else {
return -1;
}
}
}
return 0;
var _a;
}
exports.compareTo = compareTo;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var add_1 = __webpack_require__(0);
function subtract(number1, number2) {
number1 = number1.toString();
number2 = number2.toString();
number2 = negate(number2);
return add_1.add(number1, number2);
}
exports.subtract = subtract;
function negate(number) {
if (number[0] == '-') {
number = number.substr(1);
}
else {
number = '-' + number;
}
return number;
}
exports.negate = negate;
/***/ })
/******/ ]);
});

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

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

@@ -48,2 +48,7 @@ var bigDecimal =

/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules

@@ -64,4 +69,5 @@ /******/ __webpack_require__.n = function(module) {

/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 3);
/******/ return __webpack_require__(__webpack_require__.s = 7);
/******/ })

@@ -186,3 +192,51 @@ /************************************************************************/

Object.defineProperty(exports, "__esModule", { value: true });
var roundingModes_1 = __webpack_require__(2);
var RoundingModes;
(function (RoundingModes) {
/**
* Rounding mode to round towards positive infinity.
*/
RoundingModes[RoundingModes["CEILING"] = 0] = "CEILING";
/**
* Rounding mode to round towards zero.
*/
RoundingModes[RoundingModes["DOWN"] = 1] = "DOWN";
/**
* Rounding mode to round towards negative infinity.
*/
RoundingModes[RoundingModes["FLOOR"] = 2] = "FLOOR";
/**
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
* in which case round down.
*/
RoundingModes[RoundingModes["HALF_DOWN"] = 3] = "HALF_DOWN";
/**
* Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant,
* in which case, round towards the even neighbor.
*/
RoundingModes[RoundingModes["HALF_EVEN"] = 4] = "HALF_EVEN";
/**
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
* in which case round up.
*/
RoundingModes[RoundingModes["HALF_UP"] = 5] = "HALF_UP";
/**
* Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.
* UNIMPLEMENTED
*/
RoundingModes[RoundingModes["UNNECESSARY"] = 6] = "UNNECESSARY";
/**
* Rounding mode to round away from zero.
*/
RoundingModes[RoundingModes["UP"] = 7] = "UP";
})(RoundingModes = exports.RoundingModes || (exports.RoundingModes = {}));
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var roundingModes_1 = __webpack_require__(1);
/**

@@ -296,3 +350,3 @@ *

/***/ }),
/* 2 */
/* 3 */
/***/ (function(module, exports, __webpack_require__) {

@@ -303,38 +357,24 @@

Object.defineProperty(exports, "__esModule", { value: true });
/**
* CEILING
* Rounding mode to round towards positive infinity.
* DOWN
* Rounding mode to round towards zero.
* FLOOR
* Rounding mode to round towards negative infinity.
* HALF_DOWN
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
* in which case round down.
* HALF_EVEN
* Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant,
* in which case, round towards the even neighbor.
* HALF_UP
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
* in which case round up.
* UNNECESSARY
* Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.
* UP
* Rounding mode to round away from zero.
*/
var RoundingModes;
(function (RoundingModes) {
RoundingModes[RoundingModes["CEILING"] = 0] = "CEILING";
RoundingModes[RoundingModes["DOWN"] = 1] = "DOWN";
RoundingModes[RoundingModes["FLOOR"] = 2] = "FLOOR";
RoundingModes[RoundingModes["HALF_DOWN"] = 3] = "HALF_DOWN";
RoundingModes[RoundingModes["HALF_EVEN"] = 4] = "HALF_EVEN";
RoundingModes[RoundingModes["HALF_UP"] = 5] = "HALF_UP";
RoundingModes[RoundingModes["UNNECESSARY"] = 6] = "UNNECESSARY";
RoundingModes[RoundingModes["UP"] = 7] = "UP";
})(RoundingModes = exports.RoundingModes || (exports.RoundingModes = {}));
var add_1 = __webpack_require__(0);
function subtract(number1, number2) {
number1 = number1.toString();
number2 = number2.toString();
number2 = negate(number2);
return add_1.add(number1, number2);
}
exports.subtract = subtract;
function negate(number) {
if (number[0] == '-') {
number = number.substr(1);
}
else {
number = '-' + number;
}
return number;
}
exports.negate = negate;
/***/ }),
/* 3 */
/* 4 */
/***/ (function(module, exports, __webpack_require__) {

@@ -344,10 +384,262 @@

Object.defineProperty(exports, "__esModule", { value: true });
var add_1 = __webpack_require__(0);
var round_1 = __webpack_require__(1);
var multiply_1 = __webpack_require__(4);
function compareTo(number1, number2) {
var negative = false;
if (number1[0] == '-' && number2[0] != "-") {
return -1;
}
else if (number1[0] != '-' && number2[0] == '-') {
return 1;
}
else if (number1[0] == '-' && number2[0] == '-') {
number1 = number1.substr(1);
number2 = number2.substr(1);
negative = true;
}
_a = add_1.pad(number1, number2), number1 = _a[0], number2 = _a[1];
if (number1.localeCompare(number2) == 0) {
return 0;
}
for (var i = 0; i < number1.length; i++) {
if (number1[i] == number2[i]) {
continue;
}
else if (number1[i] > number2[i]) {
if (negative) {
return -1;
}
else {
return 1;
}
}
else {
if (negative) {
return 1;
}
else {
return -1;
}
}
}
return 0;
var _a;
}
exports.compareTo = compareTo;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var add_1 = __webpack_require__(0);
var round_1 = __webpack_require__(2);
function divide(dividend, divisor, precission) {
if (precission === void 0) { precission = 8; }
if (divisor == 0) {
throw new Error('Cannot divide by 0');
}
dividend = dividend.toString();
divisor = divisor.toString();
if (dividend == 0)
return '0';
var neg = 0;
if (divisor[0] == '-') {
divisor = divisor.substring(1);
neg++;
}
if (dividend[0] == '-') {
dividend = dividend.substring(1);
neg++;
}
var pt_dvsr = divisor.indexOf('.') > 0 ? divisor.length - divisor.indexOf('.') - 1 : -1;
divisor = add_1.trim(divisor.replace('.', ''));
if (pt_dvsr >= 0) {
var pt_dvnd = dividend.indexOf('.') > 0 ? dividend.length - dividend.indexOf('.') - 1 : -1;
if (pt_dvnd == -1) {
dividend = add_1.trim(dividend + (new Array(pt_dvsr + 1)).join('0'));
}
else {
if (pt_dvsr > pt_dvnd) {
dividend = dividend.replace('.', '');
dividend = add_1.trim(dividend + (new Array(pt_dvsr - pt_dvnd + 1)).join('0'));
}
else if (pt_dvsr < pt_dvnd) {
dividend = dividend.replace('.', '');
var loc = dividend.length - pt_dvsr + pt_dvsr;
dividend = add_1.trim(dividend.substring(0, loc) + '.' + dividend.substring(loc));
}
else if (pt_dvsr == pt_dvnd) {
dividend = add_1.trim(dividend.replace('.', ''));
}
}
}
var prec = 0, dl = divisor.length, rem = '0', quotent = '';
var dvnd = (dividend.indexOf('.') > -1 && dividend.indexOf('.') < dl) ? dividend.substring(0, dl + 1) : dividend.substring(0, dl);
dividend = (dividend.indexOf('.') > -1 && dividend.indexOf('.') < dl) ? dividend.substring(dl + 1) : dividend.substring(dl);
if (dvnd.indexOf('.') > -1) {
var shift = dvnd.length - dvnd.indexOf('.') - 1;
dvnd = dvnd.replace('.', '');
if (dl > dvnd.length) {
shift += dl - dvnd.length;
dvnd = dvnd + (new Array(dl - dvnd.length + 1)).join('0');
}
prec = shift;
quotent = '0.' + (new Array(shift)).join('0');
}
precission = precission + 2;
while (prec <= precission) {
var qt = 0;
while (parseInt(dvnd) >= parseInt(divisor)) {
dvnd = add_1.add(dvnd, '-' + divisor);
qt++;
}
quotent += qt;
if (!dividend) {
if (!prec)
quotent += '.';
prec++;
dvnd = dvnd + '0';
}
else {
if (dividend[0] == '.') {
quotent += '.';
prec++;
dividend = dividend.substring(1);
}
dvnd = dvnd + dividend.substring(0, 1);
dividend = dividend.substring(1);
}
}
return ((neg == 1) ? '-' : '') + add_1.trim(round_1.roundOff(quotent, precission - 2));
}
exports.divide = divide;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function multiply(number1, number2) {
number1 = number1.toString();
number2 = number2.toString();
/*Filter numbers*/
var negative = 0;
if (number1[0] == '-') {
negative++;
number1 = number1.substr(1);
}
if (number2[0] == '-') {
negative++;
number2 = number2.substr(1);
}
number1 = trailZero(number1);
number2 = trailZero(number2);
var decimalLength1 = 0;
var decimalLength2 = 0;
if (number1.indexOf('.') != -1) {
decimalLength1 = number1.length - number1.indexOf('.') - 1;
}
if (number2.indexOf('.') != -1) {
decimalLength2 = number2.length - number2.indexOf('.') - 1;
}
var decimalLength = decimalLength1 + decimalLength2;
number1 = trailZero(number1.replace('.', ''));
number2 = trailZero(number2.replace('.', ''));
if (number1.length < number2.length) {
var temp = number1;
number1 = number2;
number2 = temp;
}
if (number2 == '0') {
return '0';
}
/*
* Core multiplication
*/
var length = number2.length;
var carry = 0;
var positionVector = [];
var currentPosition = length - 1;
var result = "";
for (var i = 0; i < length; i++) {
positionVector[i] = number1.length - 1;
}
for (var i = 0; i < 2 * number1.length; i++) {
var sum = 0;
for (var j = number2.length - 1; j >= currentPosition && j >= 0; j--) {
if (positionVector[j] > -1 && positionVector[j] < number1.length) {
sum += parseInt(number1[positionVector[j]--]) * parseInt(number2[j]);
}
}
sum += carry;
carry = Math.floor(sum / 10);
result = sum % 10 + result;
currentPosition--;
}
/*
* Formatting result
*/
result = trailZero(adjustDecimal(result, decimalLength));
if (negative == 1) {
result = '-' + result;
}
return result;
}
exports.multiply = multiply;
/*
* Add decimal point
*/
function adjustDecimal(number, decimal) {
if (decimal == 0)
return number;
else {
number = (decimal >= number.length) ? ((new Array(decimal - number.length + 1)).join('0') + number) : number;
return number.substr(0, number.length - decimal) + '.' + number.substr(number.length - decimal, decimal);
}
}
/*
* Removes zero from front and back*/
function trailZero(number) {
while (number[0] == '0') {
number = number.substr(1);
}
if (number.indexOf('.') != -1) {
while (number[number.length - 1] == '0') {
number = number.substr(0, number.length - 1);
}
}
if (number == "" || number == ".") {
number = '0';
}
else if (number[number.length - 1] == '.') {
number = number.substr(0, number.length - 1);
}
if (number[0] == '.') {
number = '0' + number;
}
return number;
}
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var add_1 = __webpack_require__(0);
var round_1 = __webpack_require__(2);
var multiply_1 = __webpack_require__(6);
var divide_1 = __webpack_require__(5);
var compareTo_1 = __webpack_require__(6);
var subtract_1 = __webpack_require__(7);
var roundingModes_1 = __webpack_require__(2);
var bigDecimal = (function () {
var compareTo_1 = __webpack_require__(4);
var subtract_1 = __webpack_require__(3);
var roundingModes_1 = __webpack_require__(1);
var bigDecimal = /** @class */ (function () {
function bigDecimal(number) {

@@ -508,282 +800,3 @@ if (number === void 0) { number = '0'; }

/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function multiply(number1, number2) {
number1 = number1.toString();
number2 = number2.toString();
/*Filter numbers*/
var negative = 0;
if (number1[0] == '-') {
negative++;
number1 = number1.substr(1);
}
if (number2[0] == '-') {
negative++;
number2 = number2.substr(1);
}
number1 = trailZero(number1);
number2 = trailZero(number2);
var decimalLength1 = 0;
var decimalLength2 = 0;
if (number1.indexOf('.') != -1) {
decimalLength1 = number1.length - number1.indexOf('.') - 1;
}
if (number2.indexOf('.') != -1) {
decimalLength2 = number2.length - number2.indexOf('.') - 1;
}
var decimalLength = decimalLength1 + decimalLength2;
number1 = trailZero(number1.replace('.', ''));
number2 = trailZero(number2.replace('.', ''));
if (number1.length < number2.length) {
var temp = number1;
number1 = number2;
number2 = temp;
}
if (number2 == '0') {
return '0';
}
/*
* Core multiplication
*/
var length = number2.length;
var carry = 0;
var positionVector = [];
var currentPosition = length - 1;
var result = "";
for (var i = 0; i < length; i++) {
positionVector[i] = number1.length - 1;
}
for (var i = 0; i < 2 * number1.length; i++) {
var sum = 0;
for (var j = number2.length - 1; j >= currentPosition && j >= 0; j--) {
if (positionVector[j] > -1 && positionVector[j] < number1.length) {
sum += parseInt(number1[positionVector[j]--]) * parseInt(number2[j]);
}
}
sum += carry;
carry = Math.floor(sum / 10);
result = sum % 10 + result;
currentPosition--;
}
/*
* Formatting result
*/
result = trailZero(adjustDecimal(result, decimalLength));
if (negative == 1) {
result = '-' + result;
}
return result;
}
exports.multiply = multiply;
/*
* Add decimal point
*/
function adjustDecimal(number, decimal) {
if (decimal == 0)
return number;
else {
number = (decimal >= number.length) ? ((new Array(decimal - number.length + 1)).join('0') + number) : number;
return number.substr(0, number.length - decimal) + '.' + number.substr(number.length - decimal, decimal);
}
}
/*
* Removes zero from front and back*/
function trailZero(number) {
while (number[0] == '0') {
number = number.substr(1);
}
if (number.indexOf('.') != -1) {
while (number[number.length - 1] == '0') {
number = number.substr(0, number.length - 1);
}
}
if (number == "" || number == ".") {
number = '0';
}
else if (number[number.length - 1] == '.') {
number = number.substr(0, number.length - 1);
}
if (number[0] == '.') {
number = '0' + number;
}
return number;
}
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var add_1 = __webpack_require__(0);
var round_1 = __webpack_require__(1);
function divide(dividend, divisor, precission) {
if (precission === void 0) { precission = 8; }
if (divisor == 0) {
throw new Error('Cannot divide by 0');
}
dividend = dividend.toString();
divisor = divisor.toString();
if (dividend == 0)
return '0';
var neg = 0;
if (divisor[0] == '-') {
divisor = divisor.substring(1);
neg++;
}
if (dividend[0] == '-') {
dividend = dividend.substring(1);
neg++;
}
var pt_dvsr = divisor.indexOf('.') > 0 ? divisor.length - divisor.indexOf('.') - 1 : -1;
divisor = add_1.trim(divisor.replace('.', ''));
if (pt_dvsr >= 0) {
var pt_dvnd = dividend.indexOf('.') > 0 ? dividend.length - dividend.indexOf('.') - 1 : -1;
if (pt_dvnd == -1) {
dividend = add_1.trim(dividend + (new Array(pt_dvsr + 1)).join('0'));
}
else {
if (pt_dvsr > pt_dvnd) {
dividend = dividend.replace('.', '');
dividend = add_1.trim(dividend + (new Array(pt_dvsr - pt_dvnd + 1)).join('0'));
}
else if (pt_dvsr < pt_dvnd) {
dividend = dividend.replace('.', '');
var loc = dividend.length - pt_dvsr + pt_dvsr;
dividend = add_1.trim(dividend.substring(0, loc) + '.' + dividend.substring(loc));
}
else if (pt_dvsr == pt_dvnd) {
dividend = add_1.trim(dividend.replace('.', ''));
}
}
}
var prec = 0, dl = divisor.length, rem = '0', quotent = '';
var dvnd = (dividend.indexOf('.') > -1 && dividend.indexOf('.') < dl) ? dividend.substring(0, dl + 1) : dividend.substring(0, dl);
dividend = (dividend.indexOf('.') > -1 && dividend.indexOf('.') < dl) ? dividend.substring(dl + 1) : dividend.substring(dl);
if (dvnd.indexOf('.') > -1) {
var shift = dvnd.length - dvnd.indexOf('.') - 1;
dvnd = dvnd.replace('.', '');
if (dl > dvnd.length) {
shift += dl - dvnd.length;
dvnd = dvnd + (new Array(dl - dvnd.length + 1)).join('0');
}
prec = shift;
quotent = '0.' + (new Array(shift)).join('0');
}
precission = precission + 2;
while (prec <= precission) {
var qt = 0;
while (parseInt(dvnd) >= parseInt(divisor)) {
dvnd = add_1.add(dvnd, '-' + divisor);
qt++;
}
quotent += qt;
if (!dividend) {
if (!prec)
quotent += '.';
prec++;
dvnd = dvnd + '0';
}
else {
if (dividend[0] == '.') {
quotent += '.';
prec++;
dividend = dividend.substring(1);
}
dvnd = dvnd + dividend.substring(0, 1);
dividend = dividend.substring(1);
}
}
return ((neg == 1) ? '-' : '') + add_1.trim(round_1.roundOff(quotent, precission - 2));
}
exports.divide = divide;
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var add_1 = __webpack_require__(0);
function compareTo(number1, number2) {
var negative = false;
if (number1[0] == '-' && number2[0] != "-") {
return -1;
}
else if (number1[0] != '-' && number2[0] == '-') {
return 1;
}
else if (number1[0] == '-' && number2[0] == '-') {
number1 = number1.substr(1);
number2 = number2.substr(1);
negative = true;
}
_a = add_1.pad(number1, number2), number1 = _a[0], number2 = _a[1];
if (number1.localeCompare(number2) == 0) {
return 0;
}
for (var i = 0; i < number1.length; i++) {
if (number1[i] == number2[i]) {
continue;
}
else if (number1[i] > number2[i]) {
if (negative) {
return -1;
}
else {
return 1;
}
}
else {
if (negative) {
return 1;
}
else {
return -1;
}
}
}
return 0;
var _a;
}
exports.compareTo = compareTo;
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var add_1 = __webpack_require__(0);
function subtract(number1, number2) {
number1 = number1.toString();
number2 = number2.toString();
number2 = negate(number2);
return add_1.add(number1, number2);
}
exports.subtract = subtract;
function negate(number) {
if (number[0] == '-') {
number = number.substr(1);
}
else {
number = '-' + number;
}
return number;
}
exports.negate = negate;
/***/ })
/******/ ]);

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

var bigDecimal=function(t){function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}var e={};return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=3)}([function(t,n,e){"use strict";function r(t,n){void 0===n&&(n="0");var e=0,r=-1;"-"==t[0]&&(e++,r=1,t=t.substring(1),t.length),"-"==n[0]&&(e++,r=2,n=n.substring(1),n.length),t=u(t),n=u(n),l=o(u(t),u(n)),t=l[0],n=l[1],1==e&&(1==r?t=i(t):n=i(n));var s=a(t,n);return e?2==e?"-"+u(s):t.length<s.length?u(s.substring(1)):"-"+u(i(s)):u(s);var l}function i(t){for(var n="",e=t.length,r=t.split(".")[1],i=r?r.length:0,u=0;u<e;u++)t[u]>="0"&&t[u]<="9"?n+=9-parseInt(t[u]):n+=t[u];return a(n,i>0?"0."+new Array(i).join("0")+"1":"1")}function u(t){var n=t.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 o(t,n){var e=t.split("."),r=n.split("."),i=e[0].length,u=r[0].length;return i>u?r[0]=new Array(Math.abs(i-u)+1).join("0")+(r[0]?r[0]:""):e[0]=new Array(Math.abs(i-u)+1).join("0")+(e[0]?e[0]:""),i=e[1]?e[1].length:0,u=r[1]?r[1].length:0,(i||u)&&(i>u?r[1]=(r[1]?r[1]:"")+new Array(Math.abs(i-u)+1).join("0"):e[1]=(e[1]?e[1]:"")+new Array(Math.abs(i-u)+1).join("0")),t=e[0]+(e[1]?"."+e[1]:""),n=r[0]+(r[1]?"."+r[1]:""),[t,n]}function a(t,n){a=o(t,n),t=a[0],n=a[1];for(var e="",r=0,i=t.length-1;i>=0;i--)if("."!==t[i]){var u=parseInt(t[i])+parseInt(n[i])+r;e=u%10+e,r=Math.floor(u/10)}else e="."+e;return r?r.toString()+e:e;var a}Object.defineProperty(n,"__esModule",{value:!0}),n.add=r,n.trim=u,n.pad=o},function(t,n,e){"use strict";function r(t,n,e){if(void 0===n&&(n=0),void 0===e&&(e=o.RoundingModes.HALF_EVEN),e===o.RoundingModes.UNNECESSARY)throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");"number"==typeof t&&(t=t.toString());var a=!1;"-"===t[0]&&(a=!0,t=t.substring(1));var s=t.split("."),l=s[0],d=s[1];if(n<0){if(n=-n,l.length<=n)return"0";var f=l.substr(0,l.length-n);return t=f+"."+l.substr(l.length-n)+d,f=r(t,0,e),(a?"-":"")+f+new Array(n+1).join("0")}if(0==n){l.length;return i(s[1],l,a,e)?(a?"-":"")+u(l):(a?"-":"")+l}if(!s[1])return(a?"-":"")+l+"."+new Array(n+1).join("0");if(s[1].length<n)return(a?"-":"")+l+"."+s[1]+new Array(n-s[1].length+1).join("0");d=s[1].substring(0,n);var g=s[1].substring(n);return g&&i(g,d,a,e)&&(d=u(d),d.length>n)?u(l,parseInt(d[0]))+"."+d.substring(1):(a?"-":"")+l+"."+d}function i(t,n,e,r){if(!t||t===new Array(t.length+1).join("0"))return!1;if(r===o.RoundingModes.DOWN||!e&&r===o.RoundingModes.FLOOR||e&&r===o.RoundingModes.CEILING)return!1;if(r===o.RoundingModes.UP||e&&r===o.RoundingModes.FLOOR||!e&&r===o.RoundingModes.CEILING)return!0;var i="5"+new Array(t.length).join("0");if(t>i)return!0;if(t<i)return!1;switch(r){case o.RoundingModes.HALF_DOWN:return!1;case o.RoundingModes.HALF_UP:return!0;case o.RoundingModes.HALF_EVEN:default:return parseInt(n[n.length-1])%2==1}}function u(t,n){void 0===n&&(n=0),n||(n=1),"number"==typeof t&&t.toString();for(var e=t.length-1,r="",i=e;i>=0;i--){var u=parseInt(t[i])+n;10==u?(n=1,u=0):n=0,r+=u}return n&&(r+=n),r.split("").reverse().join("")}Object.defineProperty(n,"__esModule",{value:!0});var o=e(2);n.roundOff=r},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});!function(t){t[t.CEILING=0]="CEILING",t[t.DOWN=1]="DOWN",t[t.FLOOR=2]="FLOOR",t[t.HALF_DOWN=3]="HALF_DOWN",t[t.HALF_EVEN=4]="HALF_EVEN",t[t.HALF_UP=5]="HALF_UP",t[t.UNNECESSARY=6]="UNNECESSARY",t[t.UP=7]="UP"}(n.RoundingModes||(n.RoundingModes={}))},function(t,n,e){"use strict";var r=e(0),i=e(1),u=e(4),o=e(5),a=e(6),s=e(7),l=e(2),d=function(){function t(n){void 0===n&&(n="0"),this.value=t.validate(n)}return t.validate=function(t){if(t){if(t=t.toString(),isNaN(t))throw Error("Parameter is not a number: "+t);"+"==t[0]&&(t=t.substring(1))}else t="0";if(/e/i.test(t)){var n=t.split(/[eE]/),e=n[0],i=n[1];e=r.trim(e),i=parseInt(i)+e.indexOf("."),e=e.replace(".",""),t=e.length<i?e+new Array(i-e.length+1).join("0"):e.length>=i&&i>0?r.trim(e.substring(0,i))+(e.length>i?"."+e.substring(i):""):"0."+new Array(1-i).join("0")+e}return t},t.prototype.getValue=function(){return this.value},t.getPrettyValue=function(n,e,r){if(e||r){if(!e||!r)throw Error("Illegal Arguments. Should pass both digits and separator or pass none")}else e=3,r=",";n=t.validate(n);var i="-"==n.charAt(0);i&&(n=n.substring(1));var u=n.indexOf(".");u=u>0?u:n.length;for(var o="",a=u;a>0;)a<e?(e=a,a=0):a-=e,o=n.substring(a,a+e)+(a<u-e&&a>=0?r:"")+o;return(i?"-":"")+o+n.substring(u)},t.prototype.getPrettyValue=function(n,e){return t.getPrettyValue(this.value,n,e)},t.round=function(n,e,r){if(void 0===e&&(e=0),void 0===r&&(r=l.RoundingModes.HALF_EVEN),n=t.validate(n),isNaN(e))throw Error("Precision is not a number: "+e);return i.roundOff(n,e,r)},t.prototype.round=function(n,e){if(void 0===n&&(n=0),void 0===e&&(e=l.RoundingModes.HALF_EVEN),isNaN(n))throw Error("Precision is not a number: "+n);return new t(i.roundOff(this.value,n,e))},t.floor=function(n){return n=t.validate(n),-1===n.indexOf(".")?n:t.round(t.subtract(n,.5))},t.prototype.floor=function(){return-1===this.value.indexOf(".")?new t(this.value):this.subtract(new t(.5)).round()},t.ceil=function(n){return n=t.validate(n),-1===n.indexOf(".")?n:t.round(t.add(n,.5))},t.prototype.ceil=function(){return-1===this.value.indexOf(".")?new t(this.value):this.add(new t(.5)).round()},t.add=function(n,e){return n=t.validate(n),e=t.validate(e),r.add(n,e)},t.prototype.add=function(n){return new t(r.add(this.value,n.getValue()))},t.subtract=function(n,e){return n=t.validate(n),e=t.validate(e),s.subtract(n,e)},t.prototype.subtract=function(n){return new t(s.subtract(this.value,n.getValue()))},t.multiply=function(n,e){return n=t.validate(n),e=t.validate(e),u.multiply(n,e)},t.prototype.multiply=function(n){return new t(u.multiply(this.value,n.getValue()))},t.divide=function(n,e,r){return n=t.validate(n),e=t.validate(e),o.divide(n,e,r)},t.prototype.divide=function(n,e){return new t(o.divide(this.value,n.getValue(),e))},t.compareTo=function(n,e){return n=t.validate(n),e=t.validate(e),a.compareTo(n,e)},t.prototype.compareTo=function(t){return a.compareTo(this.value,t.getValue())},t.negate=function(n){return n=t.validate(n),s.negate(n)},t.prototype.negate=function(){return new t(s.negate(this.value))},t.RoundingModes=l.RoundingModes,t}();t.exports=d},function(t,n,e){"use strict";function r(t,n){t=t.toString(),n=n.toString();var e=0;"-"==t[0]&&(e++,t=t.substr(1)),"-"==n[0]&&(e++,n=n.substr(1)),t=u(t),n=u(n);var r=0,o=0;-1!=t.indexOf(".")&&(r=t.length-t.indexOf(".")-1),-1!=n.indexOf(".")&&(o=n.length-n.indexOf(".")-1);var a=r+o;if(t=u(t.replace(".","")),n=u(n.replace(".","")),t.length<n.length){var s=t;t=n,n=s}if("0"==n)return"0";for(var l=n.length,d=0,f=[],g=l-1,c="",v=0;v<l;v++)f[v]=t.length-1;for(var v=0;v<2*t.length;v++){for(var h=0,p=n.length-1;p>=g&&p>=0;p--)f[p]>-1&&f[p]<t.length&&(h+=parseInt(t[f[p]--])*parseInt(n[p]));h+=d,d=Math.floor(h/10),c=h%10+c,g--}return c=u(i(c,a)),1==e&&(c="-"+c),c}function i(t,n){return 0==n?t:(t=n>=t.length?new Array(n-t.length+1).join("0")+t:t,t.substr(0,t.length-n)+"."+t.substr(t.length-n,n))}function u(t){for(;"0"==t[0];)t=t.substr(1);if(-1!=t.indexOf("."))for(;"0"==t[t.length-1];)t=t.substr(0,t.length-1);return""==t||"."==t?t="0":"."==t[t.length-1]&&(t=t.substr(0,t.length-1)),"."==t[0]&&(t="0"+t),t}Object.defineProperty(n,"__esModule",{value:!0}),n.multiply=r},function(t,n,e){"use strict";function r(t,n,e){if(void 0===e&&(e=8),0==n)throw new Error("Cannot divide by 0");if(t=t.toString(),n=n.toString(),0==t)return"0";var r=0;"-"==n[0]&&(n=n.substring(1),r++),"-"==t[0]&&(t=t.substring(1),r++);var o=n.indexOf(".")>0?n.length-n.indexOf(".")-1:-1;if(n=i.trim(n.replace(".","")),o>=0){var a=t.indexOf(".")>0?t.length-t.indexOf(".")-1:-1;if(-1==a)t=i.trim(t+new Array(o+1).join("0"));else if(o>a)t=t.replace(".",""),t=i.trim(t+new Array(o-a+1).join("0"));else if(o<a){t=t.replace(".","");var s=t.length-o+o;t=i.trim(t.substring(0,s)+"."+t.substring(s))}else o==a&&(t=i.trim(t.replace(".","")))}var l=0,d=n.length,f="",g=t.indexOf(".")>-1&&t.indexOf(".")<d?t.substring(0,d+1):t.substring(0,d);if(t=t.indexOf(".")>-1&&t.indexOf(".")<d?t.substring(d+1):t.substring(d),g.indexOf(".")>-1){var c=g.length-g.indexOf(".")-1;g=g.replace(".",""),d>g.length&&(c+=d-g.length,g+=new Array(d-g.length+1).join("0")),l=c,f="0."+new Array(c).join("0")}for(e+=2;l<=e;){for(var v=0;parseInt(g)>=parseInt(n);)g=i.add(g,"-"+n),v++;f+=v,t?("."==t[0]&&(f+=".",l++,t=t.substring(1)),g+=t.substring(0,1),t=t.substring(1)):(l||(f+="."),l++,g+="0")}return(1==r?"-":"")+i.trim(u.roundOff(f,e-2))}Object.defineProperty(n,"__esModule",{value:!0});var i=e(0),u=e(1);n.divide=r},function(t,n,e){"use strict";function r(t,n){var e=!1;if("-"==t[0]&&"-"!=n[0])return-1;if("-"!=t[0]&&"-"==n[0])return 1;if("-"==t[0]&&"-"==n[0]&&(t=t.substr(1),n=n.substr(1),e=!0),u=i.pad(t,n),t=u[0],n=u[1],0==t.localeCompare(n))return 0;for(var r=0;r<t.length;r++)if(t[r]!=n[r])return t[r]>n[r]?e?-1:1:e?1:-1;return 0;var u}Object.defineProperty(n,"__esModule",{value:!0});var i=e(0);n.compareTo=r},function(t,n,e){"use strict";function r(t,n){return t=t.toString(),n=n.toString(),n=i(n),u.add(t,n)}function i(t){return t="-"==t[0]?t.substr(1):"-"+t}Object.defineProperty(n,"__esModule",{value:!0});var u=e(0);n.subtract=r,n.negate=i}]);
var bigDecimal=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){"use strict";function r(e){for(var t="",n=e.length,r=e.split(".")[1],i=r?r.length:0,u=0;u<n;u++)e[u]>="0"&&e[u]<="9"?t+=9-parseInt(e[u]):t+=e[u];return o(t,i>0?"0."+new Array(i).join("0")+"1":"1")}function i(e){var t=e.split(".");for(t[0]||(t[0]="0");"0"==t[0][0]&&t[0].length>1;)t[0]=t[0].substring(1);return t[0]+(t[1]?"."+t[1]:"")}function u(e,t){var n=e.split("."),r=t.split("."),i=n[0].length,u=r[0].length;return i>u?r[0]=new Array(Math.abs(i-u)+1).join("0")+(r[0]?r[0]:""):n[0]=new Array(Math.abs(i-u)+1).join("0")+(n[0]?n[0]:""),i=n[1]?n[1].length:0,u=r[1]?r[1].length:0,(i||u)&&(i>u?r[1]=(r[1]?r[1]:"")+new Array(Math.abs(i-u)+1).join("0"):n[1]=(n[1]?n[1]:"")+new Array(Math.abs(i-u)+1).join("0")),[e=n[0]+(n[1]?"."+n[1]:""),t=r[0]+(r[1]?"."+r[1]:"")]}function o(e,t){e=(n=u(e,t))[0],t=n[1];for(var n,r="",i=0,o=e.length-1;o>=0;o--)if("."!==e[o]){var a=parseInt(e[o])+parseInt(t[o])+i;r=a%10+r,i=Math.floor(a/10)}else r="."+r;return i?i.toString()+r:r}Object.defineProperty(t,"__esModule",{value:!0}),t.add=function(e,t){void 0===t&&(t="0");var n=0,a=-1;"-"==e[0]&&(n++,a=1,(e=e.substring(1)).length),"-"==t[0]&&(n++,a=2,(t=t.substring(1)).length),e=i(e),t=i(t),e=(s=u(i(e),i(t)))[0],t=s[1],1==n&&(1==a?e=r(e):t=r(t));var s,l=o(e,t);return n?2==n?"-"+i(l):e.length<l.length?i(l.substring(1)):"-"+i(r(l)):i(l)},t.trim=i,t.pad=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!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"}(t.RoundingModes||(t.RoundingModes={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);function i(e,t,n,i){if(!e||e===new Array(e.length+1).join("0"))return!1;if(i===r.RoundingModes.DOWN||!n&&i===r.RoundingModes.FLOOR||n&&i===r.RoundingModes.CEILING)return!1;if(i===r.RoundingModes.UP||n&&i===r.RoundingModes.FLOOR||!n&&i===r.RoundingModes.CEILING)return!0;var u="5"+new Array(e.length).join("0");if(e>u)return!0;if(e<u)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(t[t.length-1])%2==1}}function u(e,t){void 0===t&&(t=0),t||(t=1),"number"==typeof e&&e.toString();for(var n="",r=e.length-1;r>=0;r--){var i=parseInt(e[r])+t;10==i?(t=1,i=0):t=0,n+=i}return t&&(n+=t),n.split("").reverse().join("")}t.roundOff=function e(t,n,o){if(void 0===n&&(n=0),void 0===o&&(o=r.RoundingModes.HALF_EVEN),o===r.RoundingModes.UNNECESSARY)throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");"number"==typeof t&&(t=t.toString());var a=!1;"-"===t[0]&&(a=!0,t=t.substring(1));var s=t.split("."),l=s[0],d=s[1];if(n<0){if(n=-n,l.length<=n)return"0";var f=l.substr(0,l.length-n);return(a?"-":"")+(f=e(t=f+"."+l.substr(l.length-n)+d,0,o))+new Array(n+1).join("0")}if(0==n)return l.length,i(s[1],l,a,o)?(a?"-":"")+u(l):(a?"-":"")+l;if(!s[1])return(a?"-":"")+l+"."+new Array(n+1).join("0");if(s[1].length<n)return(a?"-":"")+l+"."+s[1]+new Array(n-s[1].length+1).join("0");d=s[1].substring(0,n);var g=s[1].substring(n);return g&&i(g,d,a,o)&&(d=u(d)).length>n?u(l,parseInt(d[0]))+"."+d.substring(1):(a?"-":"")+l+"."+d}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);function i(e){return e="-"==e[0]?e.substr(1):"-"+e}t.subtract=function(e,t){return e=e.toString(),t=i(t=t.toString()),r.add(e,t)},t.negate=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);t.compareTo=function(e,t){var n,i=!1;if("-"==e[0]&&"-"!=t[0])return-1;if("-"!=e[0]&&"-"==t[0])return 1;if("-"==e[0]&&"-"==t[0]&&(e=e.substr(1),t=t.substr(1),i=!0),e=(n=r.pad(e,t))[0],t=n[1],0==e.localeCompare(t))return 0;for(var u=0;u<e.length;u++)if(e[u]!=t[u])return e[u]>t[u]?i?-1:1:i?1:-1;return 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=n(2);t.divide=function(e,t,n){if(void 0===n&&(n=8),0==t)throw new Error("Cannot divide by 0");if(e=e.toString(),t=t.toString(),0==e)return"0";var u=0;"-"==t[0]&&(t=t.substring(1),u++),"-"==e[0]&&(e=e.substring(1),u++);var o=t.indexOf(".")>0?t.length-t.indexOf(".")-1:-1;if(t=r.trim(t.replace(".","")),o>=0){var a=e.indexOf(".")>0?e.length-e.indexOf(".")-1:-1;if(-1==a)e=r.trim(e+new Array(o+1).join("0"));else if(o>a)e=e.replace(".",""),e=r.trim(e+new Array(o-a+1).join("0"));else if(o<a){var s=(e=e.replace(".","")).length-o+o;e=r.trim(e.substring(0,s)+"."+e.substring(s))}else o==a&&(e=r.trim(e.replace(".","")))}var l=0,d=t.length,f="",g=e.indexOf(".")>-1&&e.indexOf(".")<d?e.substring(0,d+1):e.substring(0,d);if(e=e.indexOf(".")>-1&&e.indexOf(".")<d?e.substring(d+1):e.substring(d),g.indexOf(".")>-1){var c=g.length-g.indexOf(".")-1;d>(g=g.replace(".","")).length&&(c+=d-g.length,g+=new Array(d-g.length+1).join("0")),l=c,f="0."+new Array(c).join("0")}for(n+=2;l<=n;){for(var v=0;parseInt(g)>=parseInt(t);)g=r.add(g,"-"+t),v++;f+=v,e?("."==e[0]&&(f+=".",l++,e=e.substring(1)),g+=e.substring(0,1),e=e.substring(1)):(l||(f+="."),l++,g+="0")}return(1==u?"-":"")+r.trim(i.roundOff(f,n-2))}},function(e,t,n){"use strict";function r(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(t,"__esModule",{value:!0}),t.multiply=function(e,t){e=e.toString(),t=t.toString();var n=0;"-"==e[0]&&(n++,e=e.substr(1)),"-"==t[0]&&(n++,t=t.substr(1)),e=r(e),t=r(t);var i=0,u=0;-1!=e.indexOf(".")&&(i=e.length-e.indexOf(".")-1),-1!=t.indexOf(".")&&(u=t.length-t.indexOf(".")-1);var o=i+u;if(e=r(e.replace(".","")),t=r(t.replace(".","")),e.length<t.length){var a=e;e=t,t=a}if("0"==t)return"0";for(var s,l,d=t.length,f=0,g=[],c=d-1,v="",h=0;h<d;h++)g[h]=e.length-1;for(h=0;h<2*e.length;h++){for(var p=0,b=t.length-1;b>=c&&b>=0;b--)g[b]>-1&&g[b]<e.length&&(p+=parseInt(e[g[b]--])*parseInt(t[b]));p+=f,f=Math.floor(p/10),v=p%10+v,c--}return v=r((s=v,0==(l=o)?s:(s=l>=s.length?new Array(l-s.length+1).join("0")+s:s).substr(0,s.length-l)+"."+s.substr(s.length-l,l))),1==n&&(v="-"+v),v}},function(e,t,n){"use strict";var r=n(0),i=n(2),u=n(6),o=n(5),a=n(4),s=n(3),l=n(1),d=function(){function e(t){void 0===t&&(t="0"),this.value=e.validate(t)}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/i.test(e)){var t=e.split(/[eE]/),n=t[0],i=t[1];n=r.trim(n),i=parseInt(i)+n.indexOf("."),e=(n=n.replace(".","")).length<i?n+new Array(i-n.length+1).join("0"):n.length>=i&&i>0?r.trim(n.substring(0,i))+(n.length>i?"."+n.substring(i):""):"0."+new Array(1-i).join("0")+n}return e},e.prototype.getValue=function(){return this.value},e.getPrettyValue=function(t,n,r){if(n||r){if(!n||!r)throw Error("Illegal Arguments. Should pass both digits and separator or pass none")}else n=3,r=",";var i="-"==(t=e.validate(t)).charAt(0);i&&(t=t.substring(1));for(var u=t.indexOf("."),o="",a=u=u>0?u:t.length;a>0;)a<n?(n=a,a=0):a-=n,o=t.substring(a,a+n)+(a<u-n&&a>=0?r:"")+o;return(i?"-":"")+o+t.substring(u)},e.prototype.getPrettyValue=function(t,n){return e.getPrettyValue(this.value,t,n)},e.round=function(t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=l.RoundingModes.HALF_EVEN),t=e.validate(t),isNaN(n))throw Error("Precision is not a number: "+n);return i.roundOff(t,n,r)},e.prototype.round=function(t,n){if(void 0===t&&(t=0),void 0===n&&(n=l.RoundingModes.HALF_EVEN),isNaN(t))throw Error("Precision is not a number: "+t);return new e(i.roundOff(this.value,t,n))},e.floor=function(t){return-1===(t=e.validate(t)).indexOf(".")?t:e.round(e.subtract(t,.5))},e.prototype.floor=function(){return-1===this.value.indexOf(".")?new e(this.value):this.subtract(new e(.5)).round()},e.ceil=function(t){return-1===(t=e.validate(t)).indexOf(".")?t:e.round(e.add(t,.5))},e.prototype.ceil=function(){return-1===this.value.indexOf(".")?new e(this.value):this.add(new e(.5)).round()},e.add=function(t,n){return t=e.validate(t),n=e.validate(n),r.add(t,n)},e.prototype.add=function(t){return new e(r.add(this.value,t.getValue()))},e.subtract=function(t,n){return t=e.validate(t),n=e.validate(n),s.subtract(t,n)},e.prototype.subtract=function(t){return new e(s.subtract(this.value,t.getValue()))},e.multiply=function(t,n){return t=e.validate(t),n=e.validate(n),u.multiply(t,n)},e.prototype.multiply=function(t){return new e(u.multiply(this.value,t.getValue()))},e.divide=function(t,n,r){return t=e.validate(t),n=e.validate(n),o.divide(t,n,r)},e.prototype.divide=function(t,n){return new e(o.divide(this.value,t.getValue(),n))},e.compareTo=function(t,n){return t=e.validate(t),n=e.validate(n),a.compareTo(t,n)},e.prototype.compareTo=function(e){return a.compareTo(this.value,e.getValue())},e.negate=function(t){return t=e.validate(t),s.negate(t)},e.prototype.negate=function(){return new e(s.negate(this.value))},e.RoundingModes=l.RoundingModes,e}();e.exports=d}]);
{
"name": "js-big-decimal",
"version": "1.2.0",
"version": "1.2.1",
"description": "Work with large numbers on the client side. Round them off to any required precission.",

@@ -49,4 +49,4 @@ "main": "dist/node/js-big-decimal",

"devDependencies": {
"@types/jasmine": "^2.5.53",
"@types/node": "^8.0.17",
"@types/jasmine": "^2.8.7",
"@types/node": "^10.1.1",
"del": "^3.0.0",

@@ -56,8 +56,9 @@ "glob": "^7.1.2",

"gulp-run": "^1.7.1",
"jasmine-spec-reporter": "^4.1.1",
"jasmine-ts": "^0.2.0",
"webpack": "^3.4.0"
"jasmine-spec-reporter": "^4.2.1",
"jasmine-ts": "^0.2.1",
"uglifyjs-webpack-plugin": "^1.2.5",
"webpack": "^4.8.3",
"webpack-cli": "^2.1.3"
},
"false": {},
"dependencies": {}
"false": {}
}

@@ -22,3 +22,3 @@ # JS Big Decimal

- [getPrettyValue(number, digits, separator)](#getprettyvaluenumber-digits-separator)
- [round(number, precision)](#roundnumber-precision)
- [round(number, precision, roundingMode)](#roundnumber-precision-roundingmode)
- [floor(number)](#floornumber)

@@ -25,0 +25,0 @@ - [ceil(number)](#ceilnumber)

Sorry, the diff of this file is not supported yet

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