Skip to content

Commit fc8ea3d

Browse files
committed
docs: update for README
1 parent f92e69e commit fc8ea3d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
A short and concise JavaScript library for the four fundamental operations of arithmetic, which supports the addition, subtraction, multiplication and division calculation of floating-point precision.
3232

33-
提供常见的加(`add`)、减(`sub`)、乘(`mul`)、除(`div`)计算方法,可满足涉及金额、价格处理等前端数据计算的大多数应用场景。
34-
3533
## Features
3634

3735
- Short and sharp. It only includes the calculation of addition, subtraction, multiplication and division. The core code is less than 100 lines. There is no other dependency.
@@ -51,7 +49,7 @@ These libraries are recommended:
5149
- [bignumber.js](https://github.com/MikeMcl/bignumber.js)
5250
- [big.js/](https://github.com/MikeMcl/big.js/)
5351

54-
## 安装
52+
## Install
5553

5654
```bash
5755
# npm
@@ -62,7 +60,7 @@ yarn add @lzwme/asmd-calc
6260
pnpm add @lzwme/asmd-calc
6361
```
6462

65-
## USEAGE
63+
## Useage
6664

6765
### 1. Calculation example using simple tool method
6866

@@ -126,7 +124,7 @@ console.log(calc.add(0.1).add(0.2, 0.3));
126124
- `mul(...args);` - Multiplication
127125
- `div(...args);` - Division
128126
- `keepDotLength(value, len, isRounding = false): number;` - Keep N decimal places
129-
- `toFixed(value, len): string;` - 保留 N 位小数(四舍五入,返回字符串)
127+
- `toFixed(value, len): string;` - Similar to `Number.prototype.toFixed`, but fixed precision of the result
130128
- `getDecimalLen(num): number;` - Get the decimal length
131129
- `toNonExponential(num): string;` - Convert to string format of unscientific counting method
132130

@@ -178,9 +176,12 @@ Pre execution of 1000000 times and then stats time-consuming of execution of `10
178176
| mul-10000 | 9.995ms | 35.685ms | 224.357ms |
179177
| div-10000 | 15.666ms | 77.407ms | 280.322ms |
180178

181-
## Reference
179+
## References
182180

181+
- [754-2008 – IEEE Standard for Floating-Point Arithmetic](https://ieeexplore.ieee.org/document/4610935)
182+
- [Floating Point Math – https://0.30000000000000004.com](https://0.30000000000000004.com)
183183
- [确保前端 JavaScript 浮点数精度的四则运算方法](https://lzw.me/a/javascript-floating-point-arithmetic.html)
184+
184185
## License
185186

186187
`@lzwme/asmd-calc` is released under the MIT license.

tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
"compilerOptions": {
33
"target": "esnext",
44
"outDir": "build/module",
5-
"rootDir": "src",
65
"moduleResolution": "node",
76
"inlineSourceMap": false,
87
"esModuleInterop": true,
98
"noUnusedLocals": true,
109
"noUnusedParameters": true,
1110
"noImplicitReturns": true,
12-
"noFallthroughCasesInSwitch": true ,
11+
"noFallthroughCasesInSwitch": true,
1312

1413
/* Debugging Options */
1514
"traceResolution": false,

0 commit comments

Comments
 (0)