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

@phensley/decimal

Package Overview
Dependencies
Maintainers
1
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@phensley/decimal - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

12

lib-es/decimal.js

@@ -549,3 +549,3 @@ import { add, divide, multiply, subtract, trimLeadingZeros, DivMod } from './math';

var r = this.formatString(coeff, minIntegers);
return coeff.isZero() ? r : exp === 0 ? r : r + ("E" + (exp > 0 ? '+' : '') + exp);
return coeff.isZero() ? r : exp === 0 ? r : r + "E".concat(exp > 0 ? '+' : '').concat(exp);
};

@@ -572,3 +572,3 @@ /**

var sign = exp < 0 ? { type: 'minus', value: '-' } : { type: 'plus', value: '+' };
return r.concat([{ type: 'exp', value: 'E' }, sign, { type: 'integer', value: "" + Math.abs(exp) }]);
return r.concat([{ type: 'exp', value: 'E' }, sign, { type: 'integer', value: "".concat(Math.abs(exp)) }]);
};

@@ -1130,3 +1130,3 @@ /**

if (flags & 4 /* EXP */) {
return "Extra exponent character at " + i;
return "Extra exponent character at ".concat(i);
}

@@ -1156,3 +1156,3 @@ if (data.length > 0) {

if (flags & 1 /* SIGN */) {
return "Duplicate sign character at " + i;
return "Duplicate sign character at ".concat(i);
}

@@ -1164,3 +1164,3 @@ sign = code === 45 /* MINUS */ ? -1 : 1;

if (flags & 2 /* POINT */) {
return "Extra radix point seen at " + i;
return "Extra radix point seen at ".concat(i);
}

@@ -1190,3 +1190,3 @@ flags |= 2 /* POINT */;

default:
return "Unexpected character at " + i + ": " + str[i];
return "Unexpected character at ".concat(i, ": ").concat(str[i]);
}

@@ -1193,0 +1193,0 @@ i--;

@@ -126,3 +126,3 @@ import { POWERS10 } from './types';

if (nplusm < n) {
throw new Error("n + m must be >= n, got " + m);
throw new Error("n + m must be >= n, got ".concat(m));
}

@@ -129,0 +129,0 @@ // Storage for copy of u which is modified in place, and v which needs an

@@ -80,3 +80,3 @@ import { Decimal, DecimalConstants } from './decimal';

Rational.prototype.toString = function () {
return this.numer.toString() + " / " + this.denom.toString();
return "".concat(this.numer.toString(), " / ").concat(this.denom.toString());
};

@@ -83,0 +83,0 @@ Rational.prototype._parse = function (raw) {

@@ -119,3 +119,3 @@ "use strict";

var u = this;
v = exports.coerceDecimal(v);
v = (0, exports.coerceDecimal)(v);
if (u.flag || v.flag) {

@@ -159,5 +159,5 @@ // NAN is never equal to itself or any other value

// Data cannot be equal here
return -operations_1.compare(v.data, u.data, shift);
return -(0, operations_1.compare)(v.data, u.data, shift);
}
return operations_1.compare(u.data, v.data, -shift);
return (0, operations_1.compare)(u.data, v.data, -shift);
}

@@ -233,3 +233,3 @@ // Same number of radix digits.

Decimal.prototype.add = function (v) {
v = exports.coerceDecimal(v);
v = (0, exports.coerceDecimal)(v);
var r = this.handleFlags(0 /* ADDITION */, v);

@@ -248,3 +248,3 @@ if (r === undefined) {

Decimal.prototype.subtract = function (v) {
v = exports.coerceDecimal(v);
v = (0, exports.coerceDecimal)(v);
var r = this.handleFlags(1 /* SUBTRACTION */, v);

@@ -264,3 +264,3 @@ if (r === undefined) {

var _a = parseMathContext('half-even', context), usePrecision = _a[0], scaleprec = _a[1], rounding = _a[2];
v = exports.coerceDecimal(v);
v = (0, exports.coerceDecimal)(v);
var r = this.handleFlags(2 /* MULTIPLICATION */, v);

@@ -282,3 +282,3 @@ if (r !== undefined) {

}
w.data = math_1.multiply(u.data, v.data);
w.data = (0, math_1.multiply)(u.data, v.data);
w.sign = u.sign === v.sign ? 1 : -1;

@@ -302,3 +302,3 @@ w.trim();

Decimal.prototype.divide = function (v, context) {
v = exports.coerceDecimal(v);
v = (0, exports.coerceDecimal)(v);
var r = this.handleFlags(3 /* DIVISION */, v);

@@ -322,6 +322,6 @@ if (r !== undefined) {

}
var _b = math_1.divide(u.data, v.data), q = _b[0], rem = _b[1];
var _b = (0, math_1.divide)(u.data, v.data), q = _b[0], rem = _b[1];
w = Decimal.fromRaw(sign, exp, q, 0);
w.trim();
var hasrem = rem.length && !operations_1.allzero(rem, rem.length);
var hasrem = rem.length && !(0, operations_1.allzero)(rem, rem.length);
if (hasrem) {

@@ -353,3 +353,3 @@ var lsd = w.data[0] % 10;

Decimal.prototype.divmod = function (v) {
v = exports.coerceDecimal(v);
v = (0, exports.coerceDecimal)(v);
var rq = this.handleFlags(3 /* DIVISION */, v);

@@ -381,3 +381,3 @@ if (rq !== undefined) {

}
var _a = math_1.divide(u.data, v.data), qd = _a[0], rd = _a[1];
var _a = (0, math_1.divide)(u.data, v.data), qd = _a[0], rd = _a[1];
var q = new Decimal(ZERO);

@@ -396,3 +396,3 @@ q.data = qd;

Decimal.prototype.mod = function (v) {
v = exports.coerceDecimal(v);
v = (0, exports.coerceDecimal)(v);
var r = this.handleFlags(4 /* MOD */, v);

@@ -458,3 +458,3 @@ return r === undefined ? this.divmod(v)[1] : r;

var len = this.data.length;
return (len - 1) * 7 /* RDIGITS */ + operations_1.digitCount(this.data[len - 1]);
return (len - 1) * 7 /* RDIGITS */ + (0, operations_1.digitCount)(this.data[len - 1]);
};

@@ -565,3 +565,3 @@ /**

var r = this.formatString(coeff, minIntegers);
return coeff.isZero() ? r : exp === 0 ? r : r + ("E" + (exp > 0 ? '+' : '') + exp);
return coeff.isZero() ? r : exp === 0 ? r : r + "E".concat(exp > 0 ? '+' : '').concat(exp);
};

@@ -588,3 +588,3 @@ /**

var sign = exp < 0 ? { type: 'minus', value: '-' } : { type: 'plus', value: '+' };
return r.concat([{ type: 'exp', value: 'E' }, sign, { type: 'integer', value: "" + Math.abs(exp) }]);
return r.concat([{ type: 'exp', value: 'E' }, sign, { type: 'integer', value: "".concat(Math.abs(exp)) }]);
};

@@ -658,3 +658,3 @@ /**

var d = this.data[i];
var c = i === last ? operations_1.digitCount(d) : 7 /* RDIGITS */;
var c = i === last ? (0, operations_1.digitCount)(d) : 7 /* RDIGITS */;
// Loop over the decimal digits

@@ -917,3 +917,3 @@ for (var j = 0; j < c; j++) {

if (rest === 0) {
rest = operations_1.allzero(data, q - 1) === 0 ? 1 : 0;
rest = (0, operations_1.allzero)(data, q - 1) === 0 ? 1 : 0;
}

@@ -931,3 +931,3 @@ for (j = 0; j < data.length - q; j++) {

if (rest === 0 && q > 0) {
rest = operations_1.allzero(data, q) === 0 ? 1 : 0;
rest = (0, operations_1.allzero)(data, q) === 0 ? 1 : 0;
}

@@ -979,3 +979,3 @@ for (j = 0, i = q + 1; i < data.length; i++, j++) {

Decimal.prototype.trim = function () {
math_1.trimLeadingZeros(this.data);
(0, math_1.trimLeadingZeros)(this.data);
return this;

@@ -1060,3 +1060,3 @@ };

if (u.sign === vsign) {
w.data = math_1.add(m.data, n.data);
w.data = (0, math_1.add)(m.data, n.data);
w.sign = vsign;

@@ -1078,3 +1078,3 @@ }

}
w.data = math_1.subtract(m.data, n.data);
w.data = (0, math_1.subtract)(m.data, n.data);
w.sign = (swap & 1) === 1 ? vsign : m.sign;

@@ -1152,3 +1152,3 @@ }

if (flags & 4 /* EXP */) {
return "Extra exponent character at " + i;
return "Extra exponent character at ".concat(i);
}

@@ -1178,3 +1178,3 @@ if (data.length > 0) {

if (flags & 1 /* SIGN */) {
return "Duplicate sign character at " + i;
return "Duplicate sign character at ".concat(i);
}

@@ -1186,3 +1186,3 @@ sign = code === 45 /* MINUS */ ? -1 : 1;

if (flags & 2 /* POINT */) {
return "Extra radix point seen at " + i;
return "Extra radix point seen at ".concat(i);
}

@@ -1212,3 +1212,3 @@ flags |= 2 /* POINT */;

default:
return "Unexpected character at " + i + ": " + str[i];
return "Unexpected character at ".concat(i, ": ").concat(str[i]);
}

@@ -1215,0 +1215,0 @@ i--;

@@ -133,3 +133,3 @@ "use strict";

if (nplusm < n) {
throw new Error("n + m must be >= n, got " + m);
throw new Error("n + m must be >= n, got ".concat(m));
}

@@ -148,4 +148,4 @@ // Storage for copy of u which is modified in place, and v which needs an

if (d !== 1) {
exports.multiplyword(u, uc, nplusm, d);
exports.multiplyword(v, vc, n, d);
(0, exports.multiplyword)(u, uc, nplusm, d);
(0, exports.multiplyword)(v, vc, n, d);
}

@@ -277,3 +277,3 @@ var k = 0;

DivMod.prototype.pow10 = function (n, exp) {
return exports.divpow10(this.s, n, exp);
return (0, exports.divpow10)(this.s, n, exp);
};

@@ -284,3 +284,3 @@ /**

DivMod.prototype.word = function (n, w) {
return exports.divword(this.s, n, w);
return (0, exports.divword)(this.s, n, w);
};

@@ -287,0 +287,0 @@ return DivMod;

@@ -53,3 +53,3 @@ "use strict";

}
return Number(!exports.allzero(a, q));
return Number(!(0, exports.allzero)(a, q));
};

@@ -56,0 +56,0 @@ exports.compare = compare;

@@ -83,3 +83,3 @@ "use strict";

Rational.prototype.toString = function () {
return this.numer.toString() + " / " + this.denom.toString();
return "".concat(this.numer.toString(), " / ").concat(this.denom.toString());
};

@@ -86,0 +86,0 @@ Rational.prototype._parse = function (raw) {

{
"name": "@phensley/decimal",
"version": "1.4.1",
"version": "1.5.0",
"description": "Arbitrary precision decimal math",

@@ -42,18 +42,18 @@ "main": "lib/index.js",

"devDependencies": {
"@microsoft/api-extractor": "^7.18.5",
"@types/jest": "^27.0.1",
"@types/node": "^16.6.1",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"@microsoft/api-extractor": "~7.18.5",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.23",
"@typescript-eslint/eslint-plugin": "^5.19.0",
"@typescript-eslint/parser": "^5.19.0",
"beautify-benchmark": "^0.2.4",
"benchmark": "^2.1.4",
"chalk": "^4.1.2",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"jest": "^27.0.6",
"prettier": "^2.3.2",
"chalk": "^5.0.1",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.5.1",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
"ts-jest": "^27.0.4",
"typescript": "~4.3.5"
"ts-jest": "^27.1.4",
"typescript": "~4.6.3"
},

@@ -73,3 +73,3 @@ "jest": {

},
"gitHead": "a76ab6b597cc7f56f26d0632100b3f378f3e4e1c"
"gitHead": "44c782abcf427752159541ea330cfb19db529c0a"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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