bigint-decimal 1.0.4 → 1.0.5
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 +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ import { BigintDecimal } from 'bigint-decimal';
|
|
|
48
48
|
|
|
49
49
|
const a = new BigintDecimal("0.1");
|
|
50
50
|
const b = new BigintDecimal("0.2");
|
|
51
|
-
console.log(a.plus(b)
|
|
51
|
+
console.log(a.plus(b)); // "0.3" ✅
|
|
52
52
|
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -94,7 +94,7 @@ const result = new BigintDecimal("100")
|
|
|
94
94
|
.minus("1.1")
|
|
95
95
|
.div("2");
|
|
96
96
|
|
|
97
|
-
console.log(result
|
|
97
|
+
console.log(result); // "149.95"
|
|
98
98
|
|
|
99
99
|
```
|
|
100
100
|
|
|
@@ -120,8 +120,8 @@ Round to a specific number of decimal places. Standard rounding rules apply (hal
|
|
|
120
120
|
|
|
121
121
|
```typescript
|
|
122
122
|
const fee = new BigintDecimal("1.555");
|
|
123
|
-
console.log(fee.round(2)
|
|
124
|
-
console.log(fee.round(0)
|
|
123
|
+
console.log(fee.round(2)); // "1.56"
|
|
124
|
+
console.log(fee.round(0)); // "2"
|
|
125
125
|
|
|
126
126
|
```
|
|
127
127
|
|
|
@@ -133,11 +133,11 @@ Division operations can result in infinitely repeating decimals. `BigintDecimal`
|
|
|
133
133
|
// Change instance precision
|
|
134
134
|
const exactDiv = new BigintDecimal("1");
|
|
135
135
|
exactDiv.setPrecision(5);
|
|
136
|
-
console.log(exactDiv.div("3")
|
|
136
|
+
console.log(exactDiv.div("3")); // "0.33333"
|
|
137
137
|
|
|
138
138
|
// Change global precision for all new instances
|
|
139
139
|
BigintDecimal.setPrecisionGlobal(2);
|
|
140
|
-
console.log(new BigintDecimal("1").div("3")
|
|
140
|
+
console.log(new BigintDecimal("1").div("3")); // "0.33"
|
|
141
141
|
|
|
142
142
|
```
|
|
143
143
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bigint-decimal",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "A zero-dependency, arbitrary-precision decimal math library using native BigInt for safe financial and crypto calculations.",
|
|
5
5
|
"main": "./dist/global/index.js",
|
|
6
6
|
"author": "soso tsertsvadze",
|