@numio/bigmath 2.1.0 → 2.1.2
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/CHANGELOG.md +26 -0
- package/index.d.ts +21 -14
- package/index.js +21 -14
- package/package.json +1 -1
- package/src/abs/{main.d.ts → abs.d.ts} +1 -0
- package/src/abs/{main.js → abs.js} +1 -0
- package/src/cbrt/{main.js → cbrt.js} +1 -1
- package/src/compare/isEqual.d.ts +3 -0
- package/src/compare/isEqual.js +6 -0
- package/src/compare/isLeftGreater.d.ts +3 -0
- package/src/compare/isLeftGreater.js +6 -0
- package/src/compare/isLeftGreaterOrEqual.d.ts +3 -0
- package/src/compare/isLeftGreaterOrEqual.js +6 -0
- package/src/compare/max.d.ts +3 -0
- package/src/compare/max.js +8 -0
- package/src/compare/min.d.ts +3 -0
- package/src/compare/min.js +8 -0
- package/src/sqrt/{main.js → sqrt.js} +1 -1
- package/src/toBase/{main.d.ts → toBase.d.ts} +1 -0
- package/src/toBase/{main.js → toBase.js} +1 -0
- package/src/compare/main.d.ts +0 -11
- package/src/compare/main.js +0 -26
- package/src/shared/constant.d.ts +0 -6
- package/src/shared/constant.js +0 -6
- /package/src/IQR/{main.d.ts → iqr.d.ts} +0 -0
- /package/src/IQR/{main.js → iqr.js} +0 -0
- /package/src/MAD/{main.d.ts → mad.d.ts} +0 -0
- /package/src/MAD/{main.js → mad.js} +0 -0
- /package/src/cbrt/{main.d.ts → cbrt.d.ts} +0 -0
- /package/src/mean/{main.d.ts → mean.d.ts} +0 -0
- /package/src/mean/{main.js → mean.js} +0 -0
- /package/src/operations/add/{main.d.ts → add.d.ts} +0 -0
- /package/src/operations/add/{main.js → add.js} +0 -0
- /package/src/operations/div/{main.d.ts → div.d.ts} +0 -0
- /package/src/operations/div/{main.js → div.js} +0 -0
- /package/src/operations/mul/{main.d.ts → mul.d.ts} +0 -0
- /package/src/operations/mul/{main.js → mul.js} +0 -0
- /package/src/operations/sub/{main.d.ts → sub.d.ts} +0 -0
- /package/src/operations/sub/{main.js → sub.js} +0 -0
- /package/src/pipe/{main.d.ts → pipe.d.ts} +0 -0
- /package/src/pipe/{main.js → pipe.js} +0 -0
- /package/src/quartile/{main.d.ts → quartile.d.ts} +0 -0
- /package/src/quartile/{main.js → quartile.js} +0 -0
- /package/src/round/{main.d.ts → round.d.ts} +0 -0
- /package/src/round/{main.js → round.js} +0 -0
- /package/src/sort/{main.d.ts → sort.d.ts} +0 -0
- /package/src/sort/{main.js → sort.js} +0 -0
- /package/src/sqrt/{main.d.ts → sqrt.d.ts} +0 -0
package/CHANGELOG.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
### 2.1.2
|
2
|
+
Renamed main.ts files
|
3
|
+
Changed import path in test files
|
4
|
+
Change build config - run test on JSR and NPM versions
|
5
|
+
|
6
|
+
### 2.1.1
|
7
|
+
Fixed lib crash (NPM version)
|
8
|
+
|
9
|
+
### 2.1.0
|
10
|
+
Added `toBase` - convert number to another base
|
11
|
+
Added `abs` - absolute value
|
12
|
+
Added `isLeftGreaterOrEqual` - Is the left-hand side value greater than or equal to the right-hand side value
|
13
|
+
Added `cbrt` - cube root of a number
|
14
|
+
|
15
|
+
Added `Pipe().abs` - absolute value in pipe
|
16
|
+
Added `Pipe().resultToBase` - convert number to another base in pipe
|
17
|
+
|
18
|
+
### 2.0.0
|
19
|
+
The performance was improved. Adding, subtracting, dividing, and multiplying are now **2** to **5** times faster than before.\
|
20
|
+
Adding, subtracting, dividing, and multiplying support operations on HEX, octal, binary, and decimal numbers. Mixed-type calculations are allowed, with the final result converted to decimal.
|
21
|
+
|
22
|
+
### 1.1.0
|
23
|
+
Added `sqrt` - square root of a number\
|
24
|
+
Added `isEqual` and `isLeftGreater` - to compare 2 numbers.\
|
25
|
+
Added `MAD` - Median Absolute Deviation.\
|
26
|
+
Added `IQR` - Interquartile Range.
|
package/index.d.ts
CHANGED
@@ -1,14 +1,21 @@
|
|
1
|
-
import { add } from "./src/operations/add/
|
2
|
-
import { mul } from "./src/operations/mul/
|
3
|
-
import { sub } from "./src/operations/sub/
|
4
|
-
import { div } from "./src/operations/div/
|
5
|
-
import { round } from "./src/round/
|
6
|
-
import {
|
7
|
-
import { quartile } from "./src/quartile/
|
8
|
-
import { sort } from "./src/sort/
|
9
|
-
import { mean } from "./src/mean/
|
10
|
-
import { isEqual
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
|
1
|
+
import { add } from "./src/operations/add/add.d.ts";
|
2
|
+
import { mul } from "./src/operations/mul/mul.d.ts";
|
3
|
+
import { sub } from "./src/operations/sub/sub.d.ts";
|
4
|
+
import { div } from "./src/operations/div/div.d.ts";
|
5
|
+
import { round } from "./src/round/round.d.ts";
|
6
|
+
import { Pipe } from "./src/pipe/pipe.d.ts";
|
7
|
+
import { quartile } from "./src/quartile/quartile.d.ts";
|
8
|
+
import { sort } from "./src/sort/sort.d.ts";
|
9
|
+
import { mean } from "./src/mean/mean.d.ts";
|
10
|
+
import { isEqual } from "./src/compare/isEqual.d.ts";
|
11
|
+
import { min } from "./src/compare/min.d.ts";
|
12
|
+
import { max } from "./src/compare/max.d.ts";
|
13
|
+
import { isLeftGreaterOrEqual } from "./src/compare/isLeftGreaterOrEqual.d.ts";
|
14
|
+
import { isLeftGreater } from "./src/compare/isLeftGreater.d.ts";
|
15
|
+
import { IQR } from "./src/IQR/iqr.d.ts";
|
16
|
+
import { MAD } from "./src/MAD/mad.d.ts";
|
17
|
+
import { sqrt } from "./src/sqrt/sqrt.d.ts";
|
18
|
+
import { cbrt } from "./src/cbrt/cbrt.d.ts";
|
19
|
+
import { abs } from "./src/abs/abs.d.ts";
|
20
|
+
import { toBase } from "./src/toBase/toBase.d.ts";
|
21
|
+
export { abs, add, cbrt, div, IQR, isEqual, isLeftGreater, isLeftGreaterOrEqual, MAD, max, mean, min, mul, Pipe, quartile, round, sort, sqrt, sub, toBase, };
|
package/index.js
CHANGED
@@ -1,14 +1,21 @@
|
|
1
|
-
import { add } from "./src/operations/add/
|
2
|
-
import { mul } from "./src/operations/mul/
|
3
|
-
import { sub } from "./src/operations/sub/
|
4
|
-
import { div } from "./src/operations/div/
|
5
|
-
import { round } from "./src/round/
|
6
|
-
import {
|
7
|
-
import { quartile } from "./src/quartile/
|
8
|
-
import { sort } from "./src/sort/
|
9
|
-
import { mean } from "./src/mean/
|
10
|
-
import { isEqual
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
|
1
|
+
import { add } from "./src/operations/add/add.js";
|
2
|
+
import { mul } from "./src/operations/mul/mul.js";
|
3
|
+
import { sub } from "./src/operations/sub/sub.js";
|
4
|
+
import { div } from "./src/operations/div/div.js";
|
5
|
+
import { round } from "./src/round/round.js";
|
6
|
+
import { Pipe } from "./src/pipe/pipe.js";
|
7
|
+
import { quartile } from "./src/quartile/quartile.js";
|
8
|
+
import { sort } from "./src/sort/sort.js";
|
9
|
+
import { mean } from "./src/mean/mean.js";
|
10
|
+
import { isEqual } from "./src/compare/isEqual.js";
|
11
|
+
import { min } from "./src/compare/min.js";
|
12
|
+
import { max } from "./src/compare/max.js";
|
13
|
+
import { isLeftGreaterOrEqual } from "./src/compare/isLeftGreaterOrEqual.js";
|
14
|
+
import { isLeftGreater } from "./src/compare/isLeftGreater.js";
|
15
|
+
import { IQR } from "./src/IQR/iqr.js";
|
16
|
+
import { MAD } from "./src/MAD/mad.js";
|
17
|
+
import { sqrt } from "./src/sqrt/sqrt.js";
|
18
|
+
import { cbrt } from "./src/cbrt/cbrt.js";
|
19
|
+
import { abs } from "./src/abs/abs.js";
|
20
|
+
import { toBase } from "./src/toBase/toBase.js";
|
21
|
+
export { abs, add, cbrt, div, IQR, isEqual, isLeftGreater, isLeftGreaterOrEqual, MAD, max, mean, min, mul, Pipe, quartile, round, sort, sqrt, sub, toBase, };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@numio/bigmath",
|
3
3
|
"description": "@numio/bigmath is an arbitrary-precision arithmetic library. It can be used for basic operations with decimal numbers (integers and float)",
|
4
|
-
"version": "2.1.
|
4
|
+
"version": "2.1.2",
|
5
5
|
"keywords": [
|
6
6
|
"precision",
|
7
7
|
"arithmetic",
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { s2bi } from "../shared/utils.js";
|
2
|
+
import { isEqualInner } from "./utils.js";
|
3
|
+
/** This function returns if left and right values are equal */
|
4
|
+
export const isEqual = ({ left, right }) => {
|
5
|
+
return isEqualInner({ left: s2bi(left), right: s2bi(right) });
|
6
|
+
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { s2bi } from "../shared/utils.js";
|
2
|
+
import { isLeftGreaterInner } from "./utils.js";
|
3
|
+
/** This function returns if left value is greater than right value */
|
4
|
+
export const isLeftGreater = ({ left, right }) => {
|
5
|
+
return isLeftGreaterInner({ left: s2bi(left), right: s2bi(right) });
|
6
|
+
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { s2bi } from "../shared/utils.js";
|
2
|
+
import { isLeftGreaterOrEqualInner } from "./utils.js";
|
3
|
+
/** This function returns if left value is greater than right value or equal*/
|
4
|
+
export const isLeftGreaterOrEqual = ({ left, right }) => {
|
5
|
+
return isLeftGreaterOrEqualInner({ left: s2bi(left), right: s2bi(right) });
|
6
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { bi2s, s2bi } from "../shared/utils.js";
|
2
|
+
import { maxInner } from "./utils.js";
|
3
|
+
/** This function returns max value. */
|
4
|
+
export const max = (array) => {
|
5
|
+
const arrayInner = array.map((str) => s2bi(str));
|
6
|
+
const [bi, fpe] = maxInner(arrayInner);
|
7
|
+
return bi2s(bi, fpe);
|
8
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { bi2s, s2bi } from "../shared/utils.js";
|
2
|
+
import { minInner } from "./utils.js";
|
3
|
+
/** This function returns min value. */
|
4
|
+
export const min = (array) => {
|
5
|
+
const arrayInner = array.map((str) => s2bi(str));
|
6
|
+
const [bi, fpe] = minInner(arrayInner);
|
7
|
+
return bi2s(bi, fpe);
|
8
|
+
};
|
package/src/compare/main.d.ts
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { IsEqual, IsLeftGreater, IsLeftGreaterOrEqual, Max, Min } from "./types.d.ts";
|
2
|
-
/** This function returns max value. */
|
3
|
-
export declare const max: Max;
|
4
|
-
/** This function returns min value. */
|
5
|
-
export declare const min: Min;
|
6
|
-
/** This function returns if left value is greater than right value */
|
7
|
-
export declare const isLeftGreater: IsLeftGreater;
|
8
|
-
/** This function returns if left value is greater than right value */
|
9
|
-
export declare const isLeftGreaterOrEqual: IsLeftGreaterOrEqual;
|
10
|
-
/** This function returns if left and right values are equal */
|
11
|
-
export declare const isEqual: IsEqual;
|
package/src/compare/main.js
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
import { bi2s, s2bi } from "../shared/utils.js";
|
2
|
-
import { isEqualInner, isLeftGreaterInner, isLeftGreaterOrEqualInner, maxInner, minInner, } from "./utils.js";
|
3
|
-
/** This function returns max value. */
|
4
|
-
export const max = (array) => {
|
5
|
-
const arrayInner = array.map((str) => s2bi(str));
|
6
|
-
const [bi, fpe] = maxInner(arrayInner);
|
7
|
-
return bi2s(bi, fpe);
|
8
|
-
};
|
9
|
-
/** This function returns min value. */
|
10
|
-
export const min = (array) => {
|
11
|
-
const arrayInner = array.map((str) => s2bi(str));
|
12
|
-
const [bi, fpe] = minInner(arrayInner);
|
13
|
-
return bi2s(bi, fpe);
|
14
|
-
};
|
15
|
-
/** This function returns if left value is greater than right value */
|
16
|
-
export const isLeftGreater = ({ left, right }) => {
|
17
|
-
return isLeftGreaterInner({ left: s2bi(left), right: s2bi(right) });
|
18
|
-
};
|
19
|
-
/** This function returns if left value is greater than right value */
|
20
|
-
export const isLeftGreaterOrEqual = ({ left, right }) => {
|
21
|
-
return isLeftGreaterOrEqualInner({ left: s2bi(left), right: s2bi(right) });
|
22
|
-
};
|
23
|
-
/** This function returns if left and right values are equal */
|
24
|
-
export const isEqual = ({ left, right }) => {
|
25
|
-
return isEqualInner({ left: s2bi(left), right: s2bi(right) });
|
26
|
-
};
|
package/src/shared/constant.d.ts
DELETED
package/src/shared/constant.js
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|