bigmathlib 0.0.1-security → 1.0.0
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.
Potentially problematic release.
This version of bigmathlib might be problematic. Click here for more details.
- package/LICENSE +21 -0
- package/README.md +90 -5
- package/big.js +1048 -0
- package/big.mjs +1034 -0
- package/dist/big.min.js +1 -0
- package/dist/index.min.js +1 -0
- package/package.json +47 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 kristaclark55
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,5 +1,90 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
# 🧮 bigmathlib (NPM Package)
|
|
2
|
+
|
|
3
|
+
**bigmathlib** is a lightweight and fast arbitrary-precision decimal math library for Node.js and browser environments.
|
|
4
|
+
It allows you to work with large numbers safely without losing precision — perfect for finance, blockchain, scientific computation, and any high-precision number operations.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
9
|
+
|
|
10
|
+
- Arbitrary precision decimal arithmetic
|
|
11
|
+
- Supports add, subtract, multiply, divide, modulo, power, sqrt, comparison, rounding & formatting
|
|
12
|
+
- Configurable decimal places and rounding mode
|
|
13
|
+
- Zero dependency & highly optimized
|
|
14
|
+
- Works in **Node.js**, **Browser**, **TypeScript** environments
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 📦 Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install bigmathlib
|
|
22
|
+
# or
|
|
23
|
+
yarn add bigmathlib
|
|
24
|
+
# or
|
|
25
|
+
pnpm add bigmathlib
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 🚀 Usage
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
import Big from "bigmathlib";
|
|
34
|
+
|
|
35
|
+
const a = new Big("12345678901234567890.12345");
|
|
36
|
+
const b = new Big("10");
|
|
37
|
+
|
|
38
|
+
console.log(a.plus(b).toString()); // → "12345678901234567900.12345"
|
|
39
|
+
console.log(a.times(b).toString()); // → "123456789012345678901.2345"
|
|
40
|
+
console.log(a.div(b).toString()); // → precise division result
|
|
41
|
+
console.log(a.sqrt().toString()); // → square root with high precision
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🔧 Configuration
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
Big.DP = 50; // Decimal precision
|
|
50
|
+
Big.RM = Big.roundUp; // Rounding mode
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## API Overview
|
|
56
|
+
|
|
57
|
+
| Method | Description |
|
|
58
|
+
| ------------------------------------------------------------- | ------------------------- |
|
|
59
|
+
| `plus(y)` / `add(y)` | Addition |
|
|
60
|
+
| `minus(y)` / `sub(y)` | Subtraction |
|
|
61
|
+
| `times(y)` / `mul(y)` | Multiplication |
|
|
62
|
+
| `div(y)` | Division (with precision) |
|
|
63
|
+
| `mod(y)` | Modulo |
|
|
64
|
+
| `pow(n)` | Power (integer exponent) |
|
|
65
|
+
| `sqrt()` | Square root |
|
|
66
|
+
| `cmp(y)` | Compare numbers |
|
|
67
|
+
| `eq / gt / gte / lt / lte` | Comparisons |
|
|
68
|
+
| `toFixed / toPrecision / toExponential / toString / toNumber` | Format output |
|
|
69
|
+
|
|
70
|
+
## 📄 License
|
|
71
|
+
|
|
72
|
+
Copyright (c) 2025 kristaclark55
|
|
73
|
+
|
|
74
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
75
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
76
|
+
in the Software without restriction, including without limitation the rights
|
|
77
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
78
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
79
|
+
furnished to do so, subject to the following conditions:
|
|
80
|
+
|
|
81
|
+
The above copyright notice and this permission notice shall be included in all
|
|
82
|
+
copies or substantial portions of the Software.
|
|
83
|
+
|
|
84
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
85
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
86
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
87
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
88
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
89
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
90
|
+
SOFTWARE.
|