@phensley/decimal
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -231,3 +231,3 @@ import { DecimalFormatter, Part } from './format'; | ||
*/ | ||
protected _shiftright(shift: number, mode?: RoundingModeType): void; | ||
protected _shiftright(shift: number, mode: RoundingModeType): void; | ||
protected _setScale(scale: number, roundingMode?: RoundingModeType): void; | ||
@@ -234,0 +234,0 @@ protected _stripTrailingZeros(): void; |
@@ -155,4 +155,4 @@ import { add, divide, multiply, subtract, trimLeadingZeros, DivMod } from './math'; | ||
if (shift > 0) { | ||
var c = compare(v.data, u.data, shift); | ||
return c === 0 ? c : -c; | ||
// Data cannot be equal here | ||
return -compare(v.data, u.data, shift); | ||
} | ||
@@ -317,3 +317,3 @@ return compare(u.data, v.data, -shift); | ||
w.trim(); | ||
var hasrem = rem.length && rem[rem.length - 1] !== 0; | ||
var hasrem = rem.length && !allzero(rem, rem.length); | ||
if (hasrem) { | ||
@@ -632,6 +632,4 @@ var lsd = w.data[0] % 10; | ||
emitted++; | ||
groupFunc(); | ||
int--; | ||
if (int > 0) { | ||
groupFunc(); | ||
} | ||
zeros--; | ||
@@ -872,3 +870,2 @@ } | ||
var _a, _b, _c; | ||
if (mode === void 0) { mode = 'half-even'; } | ||
if (shift <= 0) { | ||
@@ -902,7 +899,6 @@ return; | ||
if (r === 0) { | ||
if (q > 0) { | ||
_a = div.pow10(data[q - 1], 7 /* RDIGITS */ - 1), rnd = _a[0], rest = _a[1]; | ||
if (rest === 0) { | ||
rest = allzero(data, q - 1) === 0 ? 1 : 0; | ||
} | ||
// q is always non-zero here, else there would be no shift | ||
_a = div.pow10(data[q - 1], 7 /* RDIGITS */ - 1), rnd = _a[0], rest = _a[1]; | ||
if (rest === 0) { | ||
rest = allzero(data, q - 1) === 0 ? 1 : 0; | ||
} | ||
@@ -916,5 +912,4 @@ for (j = 0; j < data.length - q; j++) { | ||
var ph = POWERS10[7 /* RDIGITS */ - r]; | ||
if (q < data.length) { | ||
_b = div.pow10(data[q], r), hiprev = _b[0], rest = _b[1]; | ||
} | ||
// q is always < data.length here; otherwise r == 0 | ||
_b = div.pow10(data[q], r), hiprev = _b[0], rest = _b[1]; | ||
_c = div.pow10(rest, r - 1), rnd = _c[0], rest = _c[1]; | ||
@@ -921,0 +916,0 @@ if (rest === 0 && q > 0) { |
@@ -234,3 +234,3 @@ import { POWERS10 } from './types'; | ||
s = u[i + j] + (v[i] + k); | ||
k = (s < u[i] || s >= 10000000 /* RADIX */) ? 1 : 0; | ||
k = s >= 10000000 /* RADIX */ ? 1 : 0; | ||
u[i + j] = k ? s - 10000000 /* RADIX */ : s; | ||
@@ -241,4 +241,4 @@ i++; | ||
s = u[i + j] + k; | ||
k = s === 10000000 /* RADIX */ ? 1 : 0; | ||
u[i + j] = k === 1 ? s - 10000000 /* RADIX */ : s; | ||
k = s === 10000000 /* RADIX */ ? 1 : /* istanbul ignore next */ 0; | ||
u[i + j] = k === 1 ? s - 10000000 /* RADIX */ : /* istanbul ignore next */ s; | ||
i++; | ||
@@ -245,0 +245,0 @@ } |
@@ -231,3 +231,3 @@ import { DecimalFormatter, Part } from './format'; | ||
*/ | ||
protected _shiftright(shift: number, mode?: RoundingModeType): void; | ||
protected _shiftright(shift: number, mode: RoundingModeType): void; | ||
protected _setScale(scale: number, roundingMode?: RoundingModeType): void; | ||
@@ -234,0 +234,0 @@ protected _stripTrailingZeros(): void; |
@@ -157,4 +157,4 @@ "use strict"; | ||
if (shift > 0) { | ||
var c = operations_1.compare(v.data, u.data, shift); | ||
return c === 0 ? c : -c; | ||
// Data cannot be equal here | ||
return -operations_1.compare(v.data, u.data, shift); | ||
} | ||
@@ -319,3 +319,3 @@ return operations_1.compare(u.data, v.data, -shift); | ||
w.trim(); | ||
var hasrem = rem.length && rem[rem.length - 1] !== 0; | ||
var hasrem = rem.length && !operations_1.allzero(rem, rem.length); | ||
if (hasrem) { | ||
@@ -634,6 +634,4 @@ var lsd = w.data[0] % 10; | ||
emitted++; | ||
groupFunc(); | ||
int--; | ||
if (int > 0) { | ||
groupFunc(); | ||
} | ||
zeros--; | ||
@@ -874,3 +872,2 @@ } | ||
var _a, _b, _c; | ||
if (mode === void 0) { mode = 'half-even'; } | ||
if (shift <= 0) { | ||
@@ -904,7 +901,6 @@ return; | ||
if (r === 0) { | ||
if (q > 0) { | ||
_a = div.pow10(data[q - 1], 7 /* RDIGITS */ - 1), rnd = _a[0], rest = _a[1]; | ||
if (rest === 0) { | ||
rest = operations_1.allzero(data, q - 1) === 0 ? 1 : 0; | ||
} | ||
// q is always non-zero here, else there would be no shift | ||
_a = div.pow10(data[q - 1], 7 /* RDIGITS */ - 1), rnd = _a[0], rest = _a[1]; | ||
if (rest === 0) { | ||
rest = operations_1.allzero(data, q - 1) === 0 ? 1 : 0; | ||
} | ||
@@ -918,5 +914,4 @@ for (j = 0; j < data.length - q; j++) { | ||
var ph = types_1.POWERS10[7 /* RDIGITS */ - r]; | ||
if (q < data.length) { | ||
_b = div.pow10(data[q], r), hiprev = _b[0], rest = _b[1]; | ||
} | ||
// q is always < data.length here; otherwise r == 0 | ||
_b = div.pow10(data[q], r), hiprev = _b[0], rest = _b[1]; | ||
_c = div.pow10(rest, r - 1), rnd = _c[0], rest = _c[1]; | ||
@@ -923,0 +918,0 @@ if (rest === 0 && q > 0) { |
@@ -236,3 +236,3 @@ "use strict"; | ||
s = u[i + j] + (v[i] + k); | ||
k = (s < u[i] || s >= 10000000 /* RADIX */) ? 1 : 0; | ||
k = s >= 10000000 /* RADIX */ ? 1 : 0; | ||
u[i + j] = k ? s - 10000000 /* RADIX */ : s; | ||
@@ -243,4 +243,4 @@ i++; | ||
s = u[i + j] + k; | ||
k = s === 10000000 /* RADIX */ ? 1 : 0; | ||
u[i + j] = k === 1 ? s - 10000000 /* RADIX */ : s; | ||
k = s === 10000000 /* RADIX */ ? 1 : /* istanbul ignore next */ 0; | ||
u[i + j] = k === 1 ? s - 10000000 /* RADIX */ : /* istanbul ignore next */ s; | ||
i++; | ||
@@ -247,0 +247,0 @@ } |
{ | ||
"name": "@phensley/decimal", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Arbitrary precision decimal math", | ||
@@ -68,3 +68,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "f2bf68a4be985fd349a9080b734e33fe3f19d949" | ||
"gitHead": "f411d4925d2d57589ef2cd9f1c13ef6871224bc3" | ||
} |
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
257784
4583