zmdms-utils 0.0.19 → 0.0.21
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/dist/es/baseUrl.js +1 -1
- package/dist/es/common.js +4 -4
- package/dist/es/test.js +158 -2
- package/package.json +1 -1
- package/src/baseUrl.ts +1 -1
- package/src/common.ts +4 -4
- package/src/test.js +40 -34
- package/dist/es/_virtual/_commonjsHelpers.js +0 -3
- package/dist/es/_virtual/decimal.js +0 -7
- package/dist/es/_virtual/test.js +0 -3
- package/dist/es/node_modules/decimal.js/decimal2.js +0 -4930
- package/dist/es/src/test.js +0 -106
package/dist/es/src/test.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import '../node_modules/decimal.js/decimal2.js';
|
|
2
|
-
import { exports as decimalExports } from '../_virtual/decimal.js';
|
|
3
|
-
|
|
4
|
-
// console.log(unescapeString("&&&啊你"));
|
|
5
|
-
|
|
6
|
-
// console.log(dangerouslySetXss("&&&啊你"));
|
|
7
|
-
|
|
8
|
-
// console.log(dangerouslySetXss1("&&&啊你"));
|
|
9
|
-
|
|
10
|
-
// functions and constants
|
|
11
|
-
// console.log("functions and constants");
|
|
12
|
-
// print(math.round(math.e, 3)); // 2.718
|
|
13
|
-
// print(math.atan2(3, -3) / math.pi); // 0.75
|
|
14
|
-
// print(math.log(10000, 10)); // 4
|
|
15
|
-
// print(math.sqrt(-4)); // 2i
|
|
16
|
-
// print(
|
|
17
|
-
// math.pow(
|
|
18
|
-
// [
|
|
19
|
-
// [-1, 2],
|
|
20
|
-
// [3, 1],
|
|
21
|
-
// ],
|
|
22
|
-
// 2
|
|
23
|
-
// )
|
|
24
|
-
// ); // [[7, 0], [0, 7]]
|
|
25
|
-
// print(math.derivative("x^2 + x", "x")); // 2 * x + 1
|
|
26
|
-
// console.log();
|
|
27
|
-
|
|
28
|
-
// // expressions
|
|
29
|
-
// console.log("expressions");
|
|
30
|
-
// print(math.evaluate("1.2 * (2 + 4.5)")); // 7.8
|
|
31
|
-
// print(math.evaluate("12.7 cm to inch")); // 5 inch
|
|
32
|
-
// print(math.evaluate("sin(45 deg) ^ 2")); // 0.5
|
|
33
|
-
// print(math.evaluate("9 / 3 + 2i")); // 3 + 2i
|
|
34
|
-
// print(math.evaluate("det([-1, 2; 3, 1])")); // -7
|
|
35
|
-
// print(math.evaluate("NaN + '0.2'")); // -7
|
|
36
|
-
// console.log();
|
|
37
|
-
|
|
38
|
-
// // chained operations
|
|
39
|
-
// console.log("chained operations");
|
|
40
|
-
// const a = math.chain(3).add(4).multiply(2).done();
|
|
41
|
-
// print(a); // 14
|
|
42
|
-
// console.log();
|
|
43
|
-
|
|
44
|
-
// // mixed use of different data types in functions
|
|
45
|
-
// console.log("mixed use of data types");
|
|
46
|
-
// print(math.add(4, [5, 6])); // number + Array, [9, 10]
|
|
47
|
-
// print(math.multiply(math.unit("5 mm"), 3)); // Unit * number, 15 mm
|
|
48
|
-
// print(math.subtract([2, 3, 4], 5)); // Array - number, [-3, -2, -1]
|
|
49
|
-
// print(math.add(math.matrix([2, 3]), [4, 5])); // Matrix + Array, [6, 8]
|
|
50
|
-
// console.log();
|
|
51
|
-
|
|
52
|
-
// /**
|
|
53
|
-
// * Helper function to output a value in the console. Value will be formatted.
|
|
54
|
-
// * @param {*} value
|
|
55
|
-
// */
|
|
56
|
-
// function print(value) {
|
|
57
|
-
// const precision = 14;
|
|
58
|
-
// console.log(math.format(value, precision));
|
|
59
|
-
// }
|
|
60
|
-
|
|
61
|
-
// const math = require("mathjs");
|
|
62
|
-
// function print(value) {
|
|
63
|
-
// const precision = 14;
|
|
64
|
-
// console.log(math.format(value, precision));
|
|
65
|
-
// }
|
|
66
|
-
|
|
67
|
-
// console.log(performance.now());
|
|
68
|
-
// console.log(math.add(0.1, 0.2));
|
|
69
|
-
// console.log(performance.now());
|
|
70
|
-
// console.log(performance.now());
|
|
71
|
-
// console.log(0.1 + 0.2);
|
|
72
|
-
// console.log(performance.now());
|
|
73
|
-
// const BigNumber = require("bignumber.js");
|
|
74
|
-
// console.log(performance.now());
|
|
75
|
-
// const num1 = new BigNumber(0.1);
|
|
76
|
-
// const num2 = new BigNumber(0.2);
|
|
77
|
-
|
|
78
|
-
// const result = num1.plus(num2);
|
|
79
|
-
|
|
80
|
-
// console.log(result.toString());
|
|
81
|
-
|
|
82
|
-
// console.log(performance.now());
|
|
83
|
-
|
|
84
|
-
const Decimal = decimalExports;
|
|
85
|
-
|
|
86
|
-
const num1 = new Decimal("0.1");
|
|
87
|
-
|
|
88
|
-
console.log(num1.add(0.21).toNumber(), typeof num1.add(0.21).toNumber());
|
|
89
|
-
|
|
90
|
-
console.log(num1.sub(0.21).toNumber(), typeof num1.sub(0.21).toNumber());
|
|
91
|
-
|
|
92
|
-
console.log(num1.mul(0.21).toNumber(), typeof num1.mul(0.21).toNumber());
|
|
93
|
-
Decimal.set({ precision: 5 });
|
|
94
|
-
console.log(
|
|
95
|
-
new Decimal(1).div(1.1).toNumber(),
|
|
96
|
-
typeof new Decimal(1).div(1.1).toNumber()
|
|
97
|
-
);
|
|
98
|
-
console.log(
|
|
99
|
-
new Decimal(1).dividedBy(1.1).toNumber(),
|
|
100
|
-
typeof new Decimal(1).dividedBy(1.1).toNumber()
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
console.log(
|
|
104
|
-
Number(new Decimal(1.1).toFixed(2)),
|
|
105
|
-
typeof Number(new Decimal(1.1).toFixed(2)).toFixed(2)
|
|
106
|
-
);
|