@numio/bigmath 1.1.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -4
- package/package.json +7 -2
- package/src/IQR/main.js +5 -4
- package/src/IQR/types.d.ts +2 -2
- package/src/IQR/utils.js +8 -9
- package/src/MAD/main.js +5 -4
- package/src/MAD/types.d.ts +2 -2
- package/src/MAD/utils.js +6 -8
- package/src/compare/main.js +14 -14
- package/src/compare/types.d.ts +5 -5
- package/src/compare/utils.js +52 -75
- package/src/mean/main.js +5 -5
- package/src/mean/types.d.ts +2 -2
- package/src/mean/utils.js +4 -7
- package/src/operations/add/main.d.ts +1 -1
- package/src/operations/add/main.js +7 -6
- package/src/operations/div/main.d.ts +1 -1
- package/src/operations/div/main.js +6 -8
- package/src/operations/div/types.d.ts +2 -3
- package/src/operations/div/utils.d.ts +1 -2
- package/src/operations/div/utils.js +33 -93
- package/src/operations/mul/main.d.ts +1 -1
- package/src/operations/mul/main.js +5 -5
- package/src/operations/sub/main.d.ts +1 -1
- package/src/operations/sub/main.js +6 -5
- package/src/pipe/main.d.ts +6 -6
- package/src/pipe/main.js +33 -35
- package/src/pipe/utils.d.ts +7 -8
- package/src/pipe/utils.js +22 -30
- package/src/quartile/main.js +7 -7
- package/src/quartile/types.d.ts +6 -6
- package/src/quartile/utils.js +9 -17
- package/src/round/constants.js +7 -7
- package/src/round/main.js +16 -17
- package/src/round/utils.js +24 -25
- package/src/shared/constant.d.ts +0 -12
- package/src/shared/constant.js +1 -13
- package/src/shared/types.d.ts +6 -5
- package/src/shared/utils.d.ts +6 -4
- package/src/shared/utils.js +64 -71
- package/src/sort/constants.js +3 -3
- package/src/sort/main.js +5 -6
- package/src/sort/types.d.ts +3 -3
- package/src/sort/utils.js +10 -12
- package/src/sqrt/main.js +6 -6
- package/src/sqrt/types.d.ts +2 -2
- package/src/sqrt/utils.js +16 -28
- package/src/operations/add/types.d.ts +0 -2
- package/src/operations/add/utils.d.ts +0 -5
- package/src/operations/add/utils.js +0 -59
- package/src/operations/mul/types.d.ts +0 -2
- package/src/operations/mul/utils.d.ts +0 -5
- package/src/operations/mul/utils.js +0 -50
- package/src/operations/sub/types.d.ts +0 -2
- package/src/operations/sub/utils.d.ts +0 -5
- package/src/operations/sub/utils.js +0 -81
- package/src/types.d.ts +0 -7
@@ -1,7 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { subRoute } from "./utils.js";
|
1
|
+
import { bi2s, s2bi } from "../../shared/utils.js";
|
2
|
+
import { calcInner } from "../../shared/utils.js";
|
4
3
|
/** This function subtracts numbers (as string). */
|
5
|
-
export function sub(
|
6
|
-
|
4
|
+
export function sub(array) {
|
5
|
+
const arrayInner = array.map((str) => s2bi(str));
|
6
|
+
const [bigInt, fpe] = calcInner(arrayInner, (a, b) => a - b);
|
7
|
+
return bi2s(bigInt, fpe);
|
7
8
|
}
|
package/src/pipe/main.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import type {
|
1
|
+
import type { BI2S } from "../shared/types.d.ts";
|
2
2
|
export declare class Pipe {
|
3
3
|
#private;
|
4
4
|
constructor();
|
5
|
-
add(
|
6
|
-
sub(
|
7
|
-
div(
|
8
|
-
mul(
|
9
|
-
calc(): ReturnType<
|
5
|
+
add(array: string[]): Pipe;
|
6
|
+
sub(array: string[]): Pipe;
|
7
|
+
div(array: string[], limit?: number): Pipe;
|
8
|
+
mul(array: string[]): Pipe;
|
9
|
+
calc(): ReturnType<BI2S>;
|
10
10
|
}
|
11
11
|
/** Using this function you can chain operations (add, sub, div, mul). */
|
12
12
|
export declare const pipe: Pipe;
|
package/src/pipe/main.js
CHANGED
@@ -1,51 +1,49 @@
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
5
|
+
};
|
1
6
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
7
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
8
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
4
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
5
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
6
11
|
};
|
7
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
|
-
};
|
12
12
|
var _Pipe_result;
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
|
16
|
-
|
17
|
-
import { divRoute } from "../operations/div/utils.js";
|
18
|
-
import { mulRoute } from "../operations/mul/utils.js";
|
19
|
-
var Pipe = /** @class */ (function () {
|
20
|
-
function Pipe() {
|
13
|
+
import { bi2s, calcInner, s2bi } from "../shared/utils.js";
|
14
|
+
import { divInner } from "../operations/div/utils.js";
|
15
|
+
export class Pipe {
|
16
|
+
constructor() {
|
21
17
|
_Pipe_result.set(this, void 0);
|
22
|
-
__classPrivateFieldSet(this, _Pipe_result, DEFAULT, "f");
|
23
18
|
}
|
24
|
-
|
25
|
-
|
19
|
+
add(array) {
|
20
|
+
const arrayInner = array.map((str) => s2bi(str));
|
21
|
+
__classPrivateFieldSet(this, _Pipe_result, calcInner(arrayInner, (a, b) => a + b, __classPrivateFieldGet(this, _Pipe_result, "f")), "f");
|
26
22
|
return this;
|
27
|
-
}
|
28
|
-
|
29
|
-
|
23
|
+
}
|
24
|
+
sub(array) {
|
25
|
+
const arrayInner = array.map((str) => s2bi(str));
|
26
|
+
__classPrivateFieldSet(this, _Pipe_result, calcInner(arrayInner, (a, b) => a - b, __classPrivateFieldGet(this, _Pipe_result, "f")), "f");
|
30
27
|
return this;
|
31
|
-
}
|
32
|
-
|
33
|
-
|
34
|
-
__classPrivateFieldSet(this, _Pipe_result,
|
28
|
+
}
|
29
|
+
div(array, limit = 20) {
|
30
|
+
const arrayInner = array.map((str) => s2bi(str));
|
31
|
+
__classPrivateFieldSet(this, _Pipe_result, divInner(arrayInner, limit, __classPrivateFieldGet(this, _Pipe_result, "f")), "f");
|
35
32
|
return this;
|
36
|
-
}
|
37
|
-
|
38
|
-
|
33
|
+
}
|
34
|
+
mul(array) {
|
35
|
+
const arrayInner = array.map((str) => s2bi(str));
|
36
|
+
__classPrivateFieldSet(this, _Pipe_result, calcInner(arrayInner, (a, b) => a * b, __classPrivateFieldGet(this, _Pipe_result, "f")), "f");
|
39
37
|
return this;
|
40
|
-
}
|
41
|
-
|
42
|
-
var
|
43
|
-
|
38
|
+
}
|
39
|
+
calc() {
|
40
|
+
var _a;
|
41
|
+
const [bi, fpe] = (_a = __classPrivateFieldGet(this, _Pipe_result, "f")) !== null && _a !== void 0 ? _a : [0n, 0];
|
42
|
+
const result = bi2s(bi, fpe);
|
43
|
+
__classPrivateFieldSet(this, _Pipe_result, undefined, "f");
|
44
44
|
return result;
|
45
|
-
}
|
46
|
-
|
47
|
-
}());
|
48
|
-
export { Pipe };
|
45
|
+
}
|
46
|
+
}
|
49
47
|
_Pipe_result = new WeakMap();
|
50
48
|
/** Using this function you can chain operations (add, sub, div, mul). */
|
51
|
-
export
|
49
|
+
export const pipe = new Pipe();
|
package/src/pipe/utils.d.ts
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
import type {
|
2
|
-
import type { InputData } from "../types.d.ts";
|
1
|
+
import type { BI } from "../shared/types.d.ts";
|
3
2
|
export declare class PipeInner {
|
4
|
-
result:
|
3
|
+
result: BI | undefined;
|
5
4
|
constructor();
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
calc():
|
5
|
+
add(array: BI[]): PipeInner;
|
6
|
+
sub(array: BI[]): PipeInner;
|
7
|
+
div(array: BI[], limit?: number): PipeInner;
|
8
|
+
mul(array: BI[]): PipeInner;
|
9
|
+
calc(): BI;
|
11
10
|
}
|
package/src/pipe/utils.js
CHANGED
@@ -1,34 +1,26 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
var PipeInner = /** @class */ (function () {
|
8
|
-
function PipeInner() {
|
9
|
-
this.result = DEFAULT;
|
10
|
-
}
|
11
|
-
PipeInner.prototype.addInner = function (array) {
|
12
|
-
this.result = addRoute(array, cloneInner(this.result));
|
1
|
+
import { calcInner } from "../shared/utils.js";
|
2
|
+
import { divInner } from "../operations/div/utils.js";
|
3
|
+
export class PipeInner {
|
4
|
+
constructor() { }
|
5
|
+
add(array) {
|
6
|
+
this.result = calcInner(array, (a, b) => a + b, this.result);
|
13
7
|
return this;
|
14
|
-
}
|
15
|
-
|
16
|
-
this.result =
|
8
|
+
}
|
9
|
+
sub(array) {
|
10
|
+
this.result = calcInner(array, (a, b) => a - b, this.result);
|
17
11
|
return this;
|
18
|
-
}
|
19
|
-
|
20
|
-
this.result =
|
12
|
+
}
|
13
|
+
div(array, limit = 20) {
|
14
|
+
this.result = divInner(array, limit, this.result);
|
21
15
|
return this;
|
22
|
-
}
|
23
|
-
|
24
|
-
this.result =
|
16
|
+
}
|
17
|
+
mul(array) {
|
18
|
+
this.result = calcInner(array, (a, b) => a * b, this.result);
|
25
19
|
return this;
|
26
|
-
}
|
27
|
-
|
28
|
-
var
|
29
|
-
this.result
|
30
|
-
return
|
31
|
-
}
|
32
|
-
|
33
|
-
}());
|
34
|
-
export { PipeInner };
|
20
|
+
}
|
21
|
+
calc() {
|
22
|
+
var _a;
|
23
|
+
const res = (_a = this.result) !== null && _a !== void 0 ? _a : [0n, 0];
|
24
|
+
return res;
|
25
|
+
}
|
26
|
+
}
|
package/src/quartile/main.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import {
|
1
|
+
import { bi2s, s2bi } from "../shared/utils.js";
|
2
2
|
import { quartileInner } from "./utils.js";
|
3
3
|
/** This function returns Q1, Q2, Q3 (quartile). */
|
4
|
-
export
|
5
|
-
|
6
|
-
|
4
|
+
export const quartile = (array) => {
|
5
|
+
const arrayInner = array.map((str) => s2bi(str));
|
6
|
+
const { Q1: [Q1bi, Q1fpe], Q2: [Q2bi, Q2fpe], Q3: [Q3bi, Q3fpe] } = quartileInner(arrayInner);
|
7
7
|
return {
|
8
|
-
Q1:
|
9
|
-
Q2:
|
10
|
-
Q3:
|
8
|
+
Q1: bi2s(Q1bi, Q1fpe),
|
9
|
+
Q2: bi2s(Q2bi, Q2fpe),
|
10
|
+
Q3: bi2s(Q3bi, Q3fpe),
|
11
11
|
};
|
12
12
|
};
|
package/src/quartile/types.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import type {
|
1
|
+
import type { BI } from "../shared/types.d.ts";
|
2
2
|
export type Quartile = (array: string[]) => {
|
3
3
|
Q1: string;
|
4
4
|
Q2: string;
|
5
5
|
Q3: string;
|
6
6
|
};
|
7
|
-
export type MeanQ = (index: number, array:
|
8
|
-
export type QuartileInner = (array:
|
9
|
-
Q1:
|
10
|
-
Q2:
|
11
|
-
Q3:
|
7
|
+
export type MeanQ = (index: number, array: BI[]) => BI;
|
8
|
+
export type QuartileInner = (array: BI[]) => {
|
9
|
+
Q1: BI;
|
10
|
+
Q2: BI;
|
11
|
+
Q3: BI;
|
12
12
|
};
|
package/src/quartile/utils.js
CHANGED
@@ -1,25 +1,17 @@
|
|
1
1
|
import { PipeInner } from "../pipe/utils.js";
|
2
|
-
|
3
|
-
|
4
|
-
return new PipeInner().
|
5
|
-
cloneInner(array[idx]),
|
6
|
-
cloneInner(array[idx - 1]),
|
7
|
-
]).divInner([{
|
8
|
-
array: [50],
|
9
|
-
intLength: 1,
|
10
|
-
isFloat: false,
|
11
|
-
isNegative: false,
|
12
|
-
}]).result;
|
2
|
+
const meanQ = (idx, array) => {
|
3
|
+
const left = new PipeInner().add([array[idx], array[idx - 1]]).calc();
|
4
|
+
return new PipeInner().div([left, [2n, 0]]).calc();
|
13
5
|
};
|
14
|
-
export
|
6
|
+
export const quartileInner = (array) => {
|
15
7
|
if (array.length < 3) {
|
16
8
|
throw Error("To calculate quartile you need at least 3 elements");
|
17
9
|
}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
10
|
+
const { length } = array;
|
11
|
+
const Q2Idx = length >> 1;
|
12
|
+
const Q1Idx = Q2Idx >> 1;
|
13
|
+
const Q3Idx = length - Q1Idx;
|
14
|
+
const isEvenHalf = Q2Idx % 2 !== 0;
|
23
15
|
return {
|
24
16
|
Q1: isEvenHalf ? array[Q1Idx] : meanQ(Q1Idx, array),
|
25
17
|
Q2: length % 2 !== 0 ? array[Q2Idx] : meanQ(Q2Idx, array),
|
package/src/round/constants.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
export
|
2
|
-
export
|
3
|
-
export
|
4
|
-
export
|
5
|
-
export
|
6
|
-
export
|
7
|
-
export
|
1
|
+
export const UP = "up";
|
2
|
+
export const DOWN = "down";
|
3
|
+
export const HALF_UP = "half-up";
|
4
|
+
export const HALF_DOWN = "half-down";
|
5
|
+
export const HALF_EVEN = "half-even";
|
6
|
+
export const HALF_ODD = "half-odd";
|
7
|
+
export const ROUND_MODE = [
|
8
8
|
UP,
|
9
9
|
DOWN,
|
10
10
|
HALF_UP,
|
package/src/round/main.js
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
import { HALF_UP } from "./constants.js";
|
2
2
|
import { calcLast, handleCarryOver, handleTail } from "./utils.js";
|
3
3
|
/** This function round number. */
|
4
|
-
export
|
5
|
-
var _a;
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
var charCode = value.charCodeAt(i);
|
4
|
+
export const round = (value, options) => {
|
5
|
+
var _a, _b, _c, _d;
|
6
|
+
const roundMode = (_a = options === null || options === void 0 ? void 0 : options.roundMode) !== null && _a !== void 0 ? _a : HALF_UP;
|
7
|
+
let array = [];
|
8
|
+
let sigFig = (_b = options === null || options === void 0 ? void 0 : options.sigFig) !== null && _b !== void 0 ? _b : false;
|
9
|
+
let decimals = (_c = options === null || options === void 0 ? void 0 : options.decimals) !== null && _c !== void 0 ? _c : 0;
|
10
|
+
let isFloat = false;
|
11
|
+
let isNil = true;
|
12
|
+
for (let i = 0; i < value.length; i++) {
|
13
|
+
const charCode = value.charCodeAt(i);
|
15
14
|
if (sigFig && charCode > 48)
|
16
15
|
sigFig = false;
|
17
16
|
if (isNil && charCode > 48)
|
@@ -21,14 +20,14 @@ export var round = function (value, options) {
|
|
21
20
|
if (charCode === 46)
|
22
21
|
isFloat = true;
|
23
22
|
if (isFloat && decimals === 0) {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
const next = (_d = value.charCodeAt(i + 1)) !== null && _d !== void 0 ? _d : 0;
|
24
|
+
const prev = value.charCodeAt(i - 1);
|
25
|
+
const curr = charCode === 46 ? prev : charCode;
|
26
|
+
const [last, hasCarryOver] = calcLast(curr, next, roundMode);
|
28
27
|
if (charCode === 46)
|
29
28
|
isFloat = false;
|
30
29
|
if (hasCarryOver) {
|
31
|
-
|
30
|
+
[array, isFloat] = handleCarryOver(array, isFloat);
|
32
31
|
break;
|
33
32
|
}
|
34
33
|
charCode === 46
|
@@ -41,5 +40,5 @@ export var round = function (value, options) {
|
|
41
40
|
handleTail(array, isFloat);
|
42
41
|
return (isNil && array[array.length - 1] <= 48)
|
43
42
|
? "0"
|
44
|
-
: String.fromCharCode
|
43
|
+
: String.fromCharCode(...array);
|
45
44
|
};
|
package/src/round/utils.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { DOWN, HALF_DOWN, HALF_EVEN, HALF_ODD, HALF_UP, UP, } from "./constants.js";
|
2
|
-
export
|
3
|
-
|
2
|
+
export const handleTail = (array, isFloat) => {
|
3
|
+
let lastIdx = array.length - 1;
|
4
4
|
while (isFloat && array[lastIdx] <= 48) {
|
5
5
|
if (array[lastIdx] === 46 || array.length === 1)
|
6
6
|
isFloat = false;
|
@@ -8,53 +8,52 @@ export var handleTail = function (array, isFloat) {
|
|
8
8
|
lastIdx -= 1;
|
9
9
|
}
|
10
10
|
};
|
11
|
-
export
|
11
|
+
export const handleCarryOver = (array, isFloat) => {
|
12
12
|
var _a;
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
[57,
|
13
|
+
let hasCarryOver = true;
|
14
|
+
let idx = array.length - 1;
|
15
|
+
const mapFloat = new Map([
|
16
|
+
[57, () => {
|
17
17
|
array.pop();
|
18
18
|
idx -= 1;
|
19
19
|
}],
|
20
|
-
[46,
|
20
|
+
[46, () => {
|
21
21
|
array.pop();
|
22
22
|
idx -= 1;
|
23
23
|
isFloat = false;
|
24
24
|
}],
|
25
|
-
[0,
|
25
|
+
[0, () => {
|
26
26
|
array[idx] += 1;
|
27
27
|
hasCarryOver = false;
|
28
28
|
}],
|
29
29
|
]);
|
30
|
-
|
31
|
-
[57,
|
30
|
+
const mapInt = new Map([
|
31
|
+
[57, () => {
|
32
32
|
array[idx] = 48;
|
33
33
|
idx -= 1;
|
34
34
|
}],
|
35
|
-
[0,
|
35
|
+
[0, () => {
|
36
36
|
array[idx] += 1;
|
37
37
|
hasCarryOver = false;
|
38
38
|
}],
|
39
39
|
]);
|
40
40
|
while (hasCarryOver && idx >= 0) {
|
41
|
-
|
42
|
-
|
41
|
+
const map = isFloat ? mapFloat : mapInt;
|
42
|
+
const key = map.has(array[idx]) ? array[idx] : 0;
|
43
43
|
(_a = map.get(key)) === null || _a === void 0 ? void 0 : _a();
|
44
44
|
}
|
45
45
|
hasCarryOver && array.unshift(49);
|
46
46
|
return [array, isFloat];
|
47
47
|
};
|
48
|
-
export
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
_a);
|
48
|
+
export const calcLast = (current, next, roundMode) => {
|
49
|
+
const isEven = current % 2 === 1;
|
50
|
+
const map = {
|
51
|
+
[UP]: current + (next > 48 ? 1 : 0),
|
52
|
+
[DOWN]: current,
|
53
|
+
[HALF_UP]: current + (next >= 53 ? 1 : 0),
|
54
|
+
[HALF_DOWN]: current + (next > 53 ? 1 : 0),
|
55
|
+
[HALF_EVEN]: current + ((isEven && next >= 53) ? 1 : 0),
|
56
|
+
[HALF_ODD]: current + ((!isEven && next >= 53) ? 1 : 0),
|
57
|
+
};
|
59
58
|
return map[roundMode] > 57 ? [48, true] : [map[roundMode], false];
|
60
59
|
};
|
package/src/shared/constant.d.ts
CHANGED
@@ -1,18 +1,6 @@
|
|
1
|
-
export declare const DEFAULT: {
|
2
|
-
array: any[];
|
3
|
-
intLength: number;
|
4
|
-
isFloat: boolean;
|
5
|
-
isNegative: boolean;
|
6
|
-
};
|
7
1
|
export declare const NIL: {
|
8
2
|
array: number[];
|
9
3
|
isFloat: boolean;
|
10
4
|
isNegative: boolean;
|
11
5
|
intLength: number;
|
12
6
|
};
|
13
|
-
export declare const ONE: {
|
14
|
-
array: number[];
|
15
|
-
isFloat: boolean;
|
16
|
-
isNegative: boolean;
|
17
|
-
intLength: number;
|
18
|
-
};
|
package/src/shared/constant.js
CHANGED
@@ -1,18 +1,6 @@
|
|
1
|
-
export
|
2
|
-
array: [],
|
3
|
-
intLength: 0,
|
4
|
-
isFloat: false,
|
5
|
-
isNegative: false,
|
6
|
-
};
|
7
|
-
export var NIL = {
|
1
|
+
export const NIL = {
|
8
2
|
array: [48],
|
9
3
|
isFloat: false,
|
10
4
|
isNegative: false,
|
11
5
|
intLength: 1,
|
12
6
|
};
|
13
|
-
export var ONE = {
|
14
|
-
array: [49],
|
15
|
-
isFloat: false,
|
16
|
-
isNegative: false,
|
17
|
-
intLength: 1,
|
18
|
-
};
|
package/src/shared/types.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
export type
|
3
|
-
export type
|
4
|
-
export type
|
5
|
-
export type
|
1
|
+
export type BI = [bigint, number];
|
2
|
+
export type FillHead = (len: number, fpe: number, isNeg: boolean, hasBefore: boolean) => string;
|
3
|
+
export type TrimTail = (str: string) => string;
|
4
|
+
export type CalcInner = (array: BI[], op: (a: bigint, b: bigint) => bigint, def?: BI) => BI;
|
5
|
+
export type BI2S = (bigInt: bigint, fpe: number) => string;
|
6
|
+
export type S2BI = (str: string) => BI;
|
package/src/shared/utils.d.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
import type {
|
2
|
-
export declare const
|
3
|
-
export declare const
|
4
|
-
export declare const
|
1
|
+
import type { BI2S, CalcInner, FillHead, S2BI, TrimTail } from "./types.d.ts";
|
2
|
+
export declare const bi2s: BI2S;
|
3
|
+
export declare const s2bi: S2BI;
|
4
|
+
export declare const calcInner: CalcInner;
|
5
|
+
export declare const fillHead: FillHead;
|
6
|
+
export declare const trimTail: TrimTail;
|