@phensley/decimal
Advanced tools
Comparing version 1.2.7 to 1.3.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DecimalConstants = exports.Decimal = exports.coerceDecimal = exports.DECIMAL_DIGITS = void 0; | ||
var math_1 = require("./math"); | ||
@@ -27,5 +28,6 @@ var operations_1 = require("./operations"); | ||
*/ | ||
exports.coerceDecimal = function (n) { | ||
var coerceDecimal = function (n) { | ||
return typeof n === 'number' || typeof n === 'string' ? new Decimal(n) : n; | ||
}; | ||
exports.coerceDecimal = coerceDecimal; | ||
/** | ||
@@ -32,0 +34,0 @@ * Parses and interprets a math context argument, with appropriate defaults. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PartsDecimalFormatter = exports.StringDecimalFormatter = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ * Formats a decimal into a string. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.divword = exports.divpow10 = exports.DivMod = exports.trimLeadingZeros = exports.divide = exports.multiplyword = exports.multiply = exports.subtract = exports.add = void 0; | ||
var types_1 = require("./types"); | ||
@@ -9,3 +10,3 @@ /** | ||
*/ | ||
exports.add = function (u, v) { | ||
var add = function (u, v) { | ||
var vlen = v.length; | ||
@@ -33,2 +34,3 @@ var n = u.length; | ||
}; | ||
exports.add = add; | ||
/** | ||
@@ -39,3 +41,3 @@ * Knuth TAoCP 4.3.1 Algorithm S | ||
*/ | ||
exports.subtract = function (u, v) { | ||
var subtract = function (u, v) { | ||
var m = u.length; | ||
@@ -70,2 +72,3 @@ var n = v.length; | ||
}; | ||
exports.subtract = subtract; | ||
/** | ||
@@ -75,3 +78,3 @@ * Knuth TAoCP 4.3.1 Algorithm M | ||
*/ | ||
exports.multiply = function (u, v) { | ||
var multiply = function (u, v) { | ||
var m = u.length; | ||
@@ -105,2 +108,3 @@ var n = v.length; | ||
}; | ||
exports.multiply = multiply; | ||
/** | ||
@@ -110,3 +114,3 @@ * Multiplication of a nonnegative integer u by a single word v, returning the product w. | ||
*/ | ||
exports.multiplyword = function (w, u, n, v) { | ||
var multiplyword = function (w, u, n, v) { | ||
var i = 0; | ||
@@ -123,2 +127,3 @@ var k = 0; | ||
}; | ||
exports.multiplyword = multiplyword; | ||
/** | ||
@@ -128,3 +133,3 @@ * Knuth TAoCP 4.3.1 Algorithm D | ||
*/ | ||
exports.divide = function (uc, vc) { | ||
var divide = function (uc, vc) { | ||
var n = vc.length; | ||
@@ -219,2 +224,3 @@ var m = uc.length - n; | ||
}; | ||
exports.divide = divide; | ||
/** | ||
@@ -262,3 +268,3 @@ * Knuth TAoCP 4.3.1 Exercise 16 | ||
*/ | ||
exports.trimLeadingZeros = function (data) { | ||
var trimLeadingZeros = function (data) { | ||
var i = data.length - 1; | ||
@@ -270,2 +276,3 @@ while (i > 0 && data[i] === 0) { | ||
}; | ||
exports.trimLeadingZeros = trimLeadingZeros; | ||
/** | ||
@@ -294,3 +301,3 @@ * Reusable quotient and remainder for repeated divmod operations. | ||
*/ | ||
exports.divpow10 = function (d, n, exp) { | ||
var divpow10 = function (d, n, exp) { | ||
var p = types_1.POWERS10[exp]; | ||
@@ -301,6 +308,7 @@ d[0] = (n / p) | 0; | ||
}; | ||
exports.divpow10 = divpow10; | ||
/** | ||
* Divide and modulus by w. Store result in d = [quotient, remainder]. | ||
*/ | ||
exports.divword = function (_d, n, div) { | ||
var divword = function (_d, n, div) { | ||
var q = (n / div) | 0; | ||
@@ -310,2 +318,3 @@ var r = n - q * div; | ||
}; | ||
exports.divword = divword; | ||
//# sourceMappingURL=math.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.digitCount = exports.allzero = exports.compare = void 0; | ||
var math_1 = require("./math"); | ||
var types_1 = require("./types"); | ||
var cmp = function (a, b) { return (a < b ? -1 : a === b ? 0 : 1); }; | ||
exports.compare = function (a, b, shift) { | ||
var compare = function (a, b, shift) { | ||
var _a, _b; | ||
@@ -54,3 +55,4 @@ var div = new math_1.DivMod(); | ||
}; | ||
exports.allzero = function (data, len) { | ||
exports.compare = compare; | ||
var allzero = function (data, len) { | ||
if (len <= data.length) { | ||
@@ -65,6 +67,7 @@ while (--len >= 0) { | ||
}; | ||
exports.allzero = allzero; | ||
/** | ||
* Returns the number of digits in w, where w < RADIX. | ||
*/ | ||
exports.digitCount = function (w) { | ||
var digitCount = function (w) { | ||
if (w < 10000 /* P4 */) { | ||
@@ -81,2 +84,3 @@ if (w < 100 /* P2 */) { | ||
}; | ||
exports.digitCount = digitCount; | ||
//# sourceMappingURL=operations.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.RationalConstants = exports.Rational = void 0; | ||
var decimal_1 = require("./decimal"); | ||
@@ -4,0 +5,0 @@ var coerceDecimal = function (n) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.POWERS10 = void 0; | ||
exports.POWERS10 = [ | ||
@@ -4,0 +5,0 @@ 1 /* P0 */, |
{ | ||
"name": "@phensley/decimal", | ||
"version": "1.2.7", | ||
"version": "1.3.0", | ||
"description": "Arbitrary precision decimal math", | ||
@@ -39,21 +39,21 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"tslib": "^1.13.0" | ||
"tslib": "^2.3.1" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.8.0", | ||
"@types/jest": "^25.2.1", | ||
"@types/node": "^14.0.1", | ||
"@typescript-eslint/eslint-plugin": "^2.33.0", | ||
"@typescript-eslint/parser": "^2.33.0", | ||
"@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", | ||
"beautify-benchmark": "^0.2.4", | ||
"benchmark": "^2.1.4", | ||
"chalk": "^4.0.0", | ||
"eslint": "^7.0.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"jest": "^26.0.1", | ||
"prettier": "^2.0.5", | ||
"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", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^25.5.1", | ||
"typescript": "~3.8.3" | ||
"ts-jest": "^27.0.4", | ||
"typescript": "~4.3.5" | ||
}, | ||
@@ -73,3 +73,3 @@ "jest": { | ||
}, | ||
"gitHead": "b67e55a91ddf420dada2375c27215b515794dbf7" | ||
"gitHead": "a0578557c1a781fecf166395ee0b9d14d68ad2bb" | ||
} |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
263355
4597
+ Addedtslib@2.8.1(transitive)
- Removedtslib@1.14.1(transitive)
Updatedtslib@^2.3.1