@rinxun/numeric-calculator 1.0.1 → 1.0.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/README.md +8 -5
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +9 -4
- package/.gitignore +0 -15
package/README.md
CHANGED
|
@@ -94,7 +94,7 @@ const inst5 = new NC(10, { enableCheckBoundary: true });
|
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
<h4>inst.plus</h4>
|
|
97
|
+
<h4>inst.plus(operands: IOperand[])</h4>
|
|
98
98
|
|
|
99
99
|
```typescript
|
|
100
100
|
const result = new NC().plus(2.134).toPrecision(); // 2.134
|
|
@@ -105,7 +105,7 @@ const result = new NC(10).plus(2.1341, '3.09', 0.65).toPrecision(); // => 10+2.1
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
<h4>inst.minus</h4>
|
|
108
|
+
<h4>inst.minus(operands: IOperand[])</h4>
|
|
109
109
|
|
|
110
110
|
```typescript
|
|
111
111
|
const result = new NC().minus(0.4).toPrecision(); // 0.4
|
|
@@ -116,7 +116,7 @@ const result = new NC(-2).minus(0.25, 1.5, 3.498).toPrecision(); // -2-0.25-1.5-
|
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
<h4>inst.times</h4>
|
|
119
|
+
<h4>inst.times(operands: IOperand[])</h4>
|
|
120
120
|
|
|
121
121
|
```typescript
|
|
122
122
|
const result = new NC().times(0.12).toPrecision(); // 0.12
|
|
@@ -127,7 +127,7 @@ const result = new NC(3.2).times(0.12, '100', 5).toPrecision(); // => 3.2*0.12*1
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
|
|
130
|
-
<h4>inst.divide</h4>
|
|
130
|
+
<h4>inst.divide(operands: IOperand[])</h4>
|
|
131
131
|
|
|
132
132
|
```typescript
|
|
133
133
|
const result = new NC().divide(3).toPrecision(); // 3
|
|
@@ -138,7 +138,7 @@ const result = new NC(-1000).divide(100, '20', 2).toPrecision(); // -1000/100/20
|
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
<h4>inst.toPrecision</h4>
|
|
141
|
+
<h4>inst.toPrecision(precision?: number)</h4>
|
|
142
142
|
|
|
143
143
|
```typescript
|
|
144
144
|
const result = new NC(1.2345).toPrecision(); // 1.2345
|
|
@@ -157,3 +157,6 @@ const result = new NC(10).plus(new NC().times(2, 4), '6').divide(new NC(12).minu
|
|
|
157
157
|
|
|
158
158
|
|
|
159
159
|
|
|
160
|
+
<h2>Changelog</h2>
|
|
161
|
+
|
|
162
|
+
If you have recently updated, please read the [changelog](https://github.com/rinxun/numeric-calculator/releases) for details of what has changed.
|
package/index.d.ts
CHANGED
|
@@ -71,8 +71,8 @@ declare class Calculator {
|
|
|
71
71
|
private calculate;
|
|
72
72
|
/**
|
|
73
73
|
* @constructor
|
|
74
|
-
* @param {IOperand|undefined} operand
|
|
75
|
-
* @param {
|
|
74
|
+
* @param {IOperand|undefined} operand Initial operand
|
|
75
|
+
* @param {IConfig|undefined} config Configurations
|
|
76
76
|
*/
|
|
77
77
|
constructor(operand?: IOperand, config?: IConfig);
|
|
78
78
|
/**
|
package/index.js
CHANGED
|
@@ -17,8 +17,8 @@ var Calculator = /** @class */ (function () {
|
|
|
17
17
|
// #region Constructor
|
|
18
18
|
/**
|
|
19
19
|
* @constructor
|
|
20
|
-
* @param {IOperand|undefined} operand
|
|
21
|
-
* @param {
|
|
20
|
+
* @param {IOperand|undefined} operand Initial operand
|
|
21
|
+
* @param {IConfig|undefined} config Configurations
|
|
22
22
|
*/
|
|
23
23
|
function Calculator(operand, config) {
|
|
24
24
|
// #region Private Variables
|
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rinxun/numeric-calculator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Calculate addition, subtaction, multiplication, division precisely, for tackling the precision issue",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"long",
|
|
7
|
+
"float",
|
|
8
|
+
"decimal",
|
|
7
9
|
"numeric",
|
|
8
|
-
"
|
|
9
|
-
"calculator"
|
|
10
|
+
"precision",
|
|
11
|
+
"calculator",
|
|
12
|
+
"addition",
|
|
13
|
+
"subtaction",
|
|
14
|
+
"multiplication",
|
|
15
|
+
"division"
|
|
10
16
|
],
|
|
11
17
|
"main": "index.js",
|
|
12
18
|
"type": "module",
|
|
@@ -37,7 +43,6 @@
|
|
|
37
43
|
"files": [
|
|
38
44
|
"*.js",
|
|
39
45
|
"*.d.ts",
|
|
40
|
-
".gitignore",
|
|
41
46
|
"package.json",
|
|
42
47
|
"README.md",
|
|
43
48
|
"LICENSE"
|