@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.
Files changed (57) hide show
  1. package/README.md +16 -4
  2. package/package.json +7 -2
  3. package/src/IQR/main.js +5 -4
  4. package/src/IQR/types.d.ts +2 -2
  5. package/src/IQR/utils.js +8 -9
  6. package/src/MAD/main.js +5 -4
  7. package/src/MAD/types.d.ts +2 -2
  8. package/src/MAD/utils.js +6 -8
  9. package/src/compare/main.js +14 -14
  10. package/src/compare/types.d.ts +5 -5
  11. package/src/compare/utils.js +52 -75
  12. package/src/mean/main.js +5 -5
  13. package/src/mean/types.d.ts +2 -2
  14. package/src/mean/utils.js +4 -7
  15. package/src/operations/add/main.d.ts +1 -1
  16. package/src/operations/add/main.js +7 -6
  17. package/src/operations/div/main.d.ts +1 -1
  18. package/src/operations/div/main.js +6 -8
  19. package/src/operations/div/types.d.ts +2 -3
  20. package/src/operations/div/utils.d.ts +1 -2
  21. package/src/operations/div/utils.js +33 -93
  22. package/src/operations/mul/main.d.ts +1 -1
  23. package/src/operations/mul/main.js +5 -5
  24. package/src/operations/sub/main.d.ts +1 -1
  25. package/src/operations/sub/main.js +6 -5
  26. package/src/pipe/main.d.ts +6 -6
  27. package/src/pipe/main.js +33 -35
  28. package/src/pipe/utils.d.ts +7 -8
  29. package/src/pipe/utils.js +22 -30
  30. package/src/quartile/main.js +7 -7
  31. package/src/quartile/types.d.ts +6 -6
  32. package/src/quartile/utils.js +9 -17
  33. package/src/round/constants.js +7 -7
  34. package/src/round/main.js +16 -17
  35. package/src/round/utils.js +24 -25
  36. package/src/shared/constant.d.ts +0 -12
  37. package/src/shared/constant.js +1 -13
  38. package/src/shared/types.d.ts +6 -5
  39. package/src/shared/utils.d.ts +6 -4
  40. package/src/shared/utils.js +64 -71
  41. package/src/sort/constants.js +3 -3
  42. package/src/sort/main.js +5 -6
  43. package/src/sort/types.d.ts +3 -3
  44. package/src/sort/utils.js +10 -12
  45. package/src/sqrt/main.js +6 -6
  46. package/src/sqrt/types.d.ts +2 -2
  47. package/src/sqrt/utils.js +16 -28
  48. package/src/operations/add/types.d.ts +0 -2
  49. package/src/operations/add/utils.d.ts +0 -5
  50. package/src/operations/add/utils.js +0 -59
  51. package/src/operations/mul/types.d.ts +0 -2
  52. package/src/operations/mul/utils.d.ts +0 -5
  53. package/src/operations/mul/utils.js +0 -50
  54. package/src/operations/sub/types.d.ts +0 -2
  55. package/src/operations/sub/utils.d.ts +0 -5
  56. package/src/operations/sub/utils.js +0 -81
  57. package/src/types.d.ts +0 -7
@@ -1,7 +1,8 @@
1
- import { DEFAULT } from "../../shared/constant.js";
2
- import { a2s, s2a } from "../../shared/utils.js";
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(strs) {
6
- return a2s(subRoute(strs.map(function (str) { return s2a(str); }), DEFAULT));
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
  }
@@ -1,12 +1,12 @@
1
- import type { A2S } from "../shared/types.d.ts";
1
+ import type { BI2S } from "../shared/types.d.ts";
2
2
  export declare class Pipe {
3
3
  #private;
4
4
  constructor();
5
- add(strs: string[]): Pipe;
6
- sub(strs: string[]): Pipe;
7
- div(strs: string[], limit?: number): Pipe;
8
- mul(strs: string[]): Pipe;
9
- calc(): ReturnType<A2S>;
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 { DEFAULT } from "../shared/constant.js";
14
- import { a2s, s2a } from "../shared/utils.js";
15
- import { subRoute } from "../operations/sub/utils.js";
16
- import { addRoute } from "../operations/add/utils.js";
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
- Pipe.prototype.add = function (strs) {
25
- __classPrivateFieldSet(this, _Pipe_result, addRoute(strs.map(function (str) { return s2a(str); }), __classPrivateFieldGet(this, _Pipe_result, "f")), "f");
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
- Pipe.prototype.sub = function (strs) {
29
- __classPrivateFieldSet(this, _Pipe_result, subRoute(strs.map(function (str) { return s2a(str); }), __classPrivateFieldGet(this, _Pipe_result, "f")), "f");
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
- Pipe.prototype.div = function (strs, limit) {
33
- if (limit === void 0) { limit = 20; }
34
- __classPrivateFieldSet(this, _Pipe_result, divRoute(strs.map(function (str) { return s2a(str); }), __classPrivateFieldGet(this, _Pipe_result, "f"), limit), "f");
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
- Pipe.prototype.mul = function (strs) {
38
- __classPrivateFieldSet(this, _Pipe_result, mulRoute(strs.map(function (str) { return s2a(str); }), __classPrivateFieldGet(this, _Pipe_result, "f")), "f");
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
- Pipe.prototype.calc = function () {
42
- var result = a2s(__classPrivateFieldGet(this, _Pipe_result, "f"));
43
- __classPrivateFieldSet(this, _Pipe_result, DEFAULT, "f");
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
- return Pipe;
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 var pipe = new Pipe();
49
+ export const pipe = new Pipe();
@@ -1,11 +1,10 @@
1
- import type { A2S } from "../shared/types.d.ts";
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: InputData;
3
+ result: BI | undefined;
5
4
  constructor();
6
- addInner(array: InputData[]): PipeInner;
7
- subInner(array: InputData[]): PipeInner;
8
- divInner(array: InputData[]): PipeInner;
9
- mulInner(array: InputData[]): PipeInner;
10
- calc(): ReturnType<A2S>;
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 { DEFAULT } from "../shared/constant.js";
2
- import { a2s, cloneInner } from "../shared/utils.js";
3
- import { subRoute } from "../operations/sub/utils.js";
4
- import { addRoute } from "../operations/add/utils.js";
5
- import { divRoute } from "../operations/div/utils.js";
6
- import { mulRoute } from "../operations/mul/utils.js";
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
- PipeInner.prototype.subInner = function (array) {
16
- this.result = subRoute(array, cloneInner(this.result));
8
+ }
9
+ sub(array) {
10
+ this.result = calcInner(array, (a, b) => a - b, this.result);
17
11
  return this;
18
- };
19
- PipeInner.prototype.divInner = function (array) {
20
- this.result = divRoute(array, cloneInner(this.result), 20);
12
+ }
13
+ div(array, limit = 20) {
14
+ this.result = divInner(array, limit, this.result);
21
15
  return this;
22
- };
23
- PipeInner.prototype.mulInner = function (array) {
24
- this.result = mulRoute(array, cloneInner(this.result));
16
+ }
17
+ mul(array) {
18
+ this.result = calcInner(array, (a, b) => a * b, this.result);
25
19
  return this;
26
- };
27
- PipeInner.prototype.calc = function () {
28
- var result = a2s(this.result);
29
- this.result = DEFAULT;
30
- return result;
31
- };
32
- return PipeInner;
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
+ }
@@ -1,12 +1,12 @@
1
- import { a2s, s2a } from "../shared/utils.js";
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 var quartile = function (strs) {
5
- var array = strs.map(function (str) { return s2a(str); });
6
- var Qs = quartileInner(array);
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: a2s(Qs.Q1),
9
- Q2: a2s(Qs.Q2),
10
- Q3: a2s(Qs.Q3),
8
+ Q1: bi2s(Q1bi, Q1fpe),
9
+ Q2: bi2s(Q2bi, Q2fpe),
10
+ Q3: bi2s(Q3bi, Q3fpe),
11
11
  };
12
12
  };
@@ -1,12 +1,12 @@
1
- import type { InputData } from "../types.d.ts";
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: InputData[]) => InputData;
8
- export type QuartileInner = (array: InputData[]) => {
9
- Q1: InputData;
10
- Q2: InputData;
11
- Q3: InputData;
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
  };
@@ -1,25 +1,17 @@
1
1
  import { PipeInner } from "../pipe/utils.js";
2
- import { cloneInner } from "../shared/utils.js";
3
- var meanQ = function (idx, array) {
4
- return new PipeInner().addInner([
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 var quartileInner = function (array) {
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
- var length = array.length;
19
- var Q2Idx = length >> 1;
20
- var Q1Idx = Q2Idx >> 1;
21
- var Q3Idx = length - Q1Idx;
22
- var isEvenHalf = Q2Idx % 2 !== 0;
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),
@@ -1,10 +1,10 @@
1
- export var UP = "up";
2
- export var DOWN = "down";
3
- export var HALF_UP = "half-up";
4
- export var HALF_DOWN = "half-down";
5
- export var HALF_EVEN = "half-even";
6
- export var HALF_ODD = "half-odd";
7
- export var ROUND_MODE = [
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 var round = function (value, options) {
5
- var _a;
6
- var _b, _c, _d, _e;
7
- var roundMode = (_b = options === null || options === void 0 ? void 0 : options.roundMode) !== null && _b !== void 0 ? _b : HALF_UP;
8
- var array = [];
9
- var sigFig = (_c = options === null || options === void 0 ? void 0 : options.sigFig) !== null && _c !== void 0 ? _c : false;
10
- var decimals = (_d = options === null || options === void 0 ? void 0 : options.decimals) !== null && _d !== void 0 ? _d : 0;
11
- var isFloat = false;
12
- var isNil = true;
13
- for (var i = 0; i < value.length; i++) {
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
- var next = (_e = value.charCodeAt(i + 1)) !== null && _e !== void 0 ? _e : 0;
25
- var prev = value.charCodeAt(i - 1);
26
- var curr = charCode === 46 ? prev : charCode;
27
- var _f = calcLast(curr, next, roundMode), last = _f[0], hasCarryOver = _f[1];
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
- _a = handleCarryOver(array, isFloat), array = _a[0], isFloat = _a[1];
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.apply(String, array);
43
+ : String.fromCharCode(...array);
45
44
  };
@@ -1,6 +1,6 @@
1
1
  import { DOWN, HALF_DOWN, HALF_EVEN, HALF_ODD, HALF_UP, UP, } from "./constants.js";
2
- export var handleTail = function (array, isFloat) {
3
- var lastIdx = array.length - 1;
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 var handleCarryOver = function (array, isFloat) {
11
+ export const handleCarryOver = (array, isFloat) => {
12
12
  var _a;
13
- var hasCarryOver = true;
14
- var idx = array.length - 1;
15
- var mapFloat = new Map([
16
- [57, function () {
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, function () {
20
+ [46, () => {
21
21
  array.pop();
22
22
  idx -= 1;
23
23
  isFloat = false;
24
24
  }],
25
- [0, function () {
25
+ [0, () => {
26
26
  array[idx] += 1;
27
27
  hasCarryOver = false;
28
28
  }],
29
29
  ]);
30
- var mapInt = new Map([
31
- [57, function () {
30
+ const mapInt = new Map([
31
+ [57, () => {
32
32
  array[idx] = 48;
33
33
  idx -= 1;
34
34
  }],
35
- [0, function () {
35
+ [0, () => {
36
36
  array[idx] += 1;
37
37
  hasCarryOver = false;
38
38
  }],
39
39
  ]);
40
40
  while (hasCarryOver && idx >= 0) {
41
- var map = isFloat ? mapFloat : mapInt;
42
- var key = map.has(array[idx]) ? array[idx] : 0;
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 var calcLast = function (current, next, roundMode) {
49
- var _a;
50
- var isEven = current % 2 === 1;
51
- var map = (_a = {},
52
- _a[UP] = current + (next > 48 ? 1 : 0),
53
- _a[DOWN] = current,
54
- _a[HALF_UP] = current + (next >= 53 ? 1 : 0),
55
- _a[HALF_DOWN] = current + (next > 53 ? 1 : 0),
56
- _a[HALF_EVEN] = current + ((isEven && next >= 53) ? 1 : 0),
57
- _a[HALF_ODD] = current + ((!isEven && next >= 53) ? 1 : 0),
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
  };
@@ -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
- };
@@ -1,18 +1,6 @@
1
- export var DEFAULT = {
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
- };
@@ -1,5 +1,6 @@
1
- import type { InputData } from "../types.d.ts";
2
- export type A2S = (input: InputData) => string;
3
- export type S2A = (strings: string) => InputData;
4
- export type Convert = (isNegative: InputData["isNegative"], array: InputData["array"]) => string;
5
- export type CloneInner = (inner: InputData) => InputData;
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;
@@ -1,4 +1,6 @@
1
- import type { A2S, CloneInner, S2A } from "./types.d.ts";
2
- export declare const a2s: A2S;
3
- export declare const s2a: S2A;
4
- export declare const cloneInner: CloneInner;
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;