@rinxun/numeric-calculator 1.0.7-alpha.1 → 1.0.7

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 (2) hide show
  1. package/README.md +12 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -64,6 +64,7 @@ The instance supports chain operations.
64
64
  - `minus(operands: IOperand[]) => instance`
65
65
  - `times(operands: IOperand[]) => instance`
66
66
  - `divide(operands: IOperand[]) => instance`
67
+ - `round(fractionDigits?: number) => number`
67
68
  - `toPrecision(precision?: number) => number`
68
69
  - `toFixed(fractionDigits?: number) => string`
69
70
 
@@ -141,6 +142,17 @@ const result = new NC(-1000).divide(100, '20', 2).toPrecision(); // -1000/100/20
141
142
 
142
143
 
143
144
 
145
+ <h4>inst.round(fractionDigits?: number)</h4>
146
+
147
+ ``` typescript
148
+ const result = new NC().round(3); // 0
149
+ const result = new NC(5.255).round(2); // 5.26
150
+ const result = new NC(7.65).times(16.5).round(2); // => 7.65 * 16.5 = 126.225 ≈ 126.23
151
+ const result = new NC(26.05).times(16.5).round(2); // => 26.05 * 16.5 = 429.825 ≈ 429.83
152
+ ```
153
+
154
+
155
+
144
156
  <h4>inst.toPrecision(precision?: number)</h4>
145
157
 
146
158
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rinxun/numeric-calculator",
3
- "version": "1.0.7-alpha.1",
3
+ "version": "1.0.7",
4
4
  "description": "Calculate addition, subtraction, multiplication, division precisely, for tackling the precision issue",
5
5
  "keywords": [
6
6
  "long",