@thi.ng/math 5.7.11 → 5.8.0
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/CHANGELOG.md +7 -1
- package/README.md +2 -2
- package/abs.d.ts +22 -0
- package/abs.js +4 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**:
|
|
3
|
+
- **Last updated**: 2024-01-26T18:03:04Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [5.8.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.8.0) (2024-01-26)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add signedPow(), add docs ([5207ba3](https://github.com/thi-ng/umbrella/commit/5207ba3))
|
|
17
|
+
|
|
12
18
|
### [5.7.2](https://github.com/thi-ng/umbrella/tree/@thi.ng/math@5.7.2) (2023-11-09)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ For Node.js REPL:
|
|
|
68
68
|
const math = await import("@thi.ng/math");
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 4.
|
|
71
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 4.09 KB
|
|
72
72
|
|
|
73
73
|
## Dependencies
|
|
74
74
|
|
|
@@ -118,4 +118,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
118
118
|
|
|
119
119
|
## License
|
|
120
120
|
|
|
121
|
-
© 2013 -
|
|
121
|
+
© 2013 - 2024 Karsten Schmidt // Apache License 2.0
|
package/abs.d.ts
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import type { FnN2 } from "@thi.ng/api";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the absolute difference between `a` and `b`.
|
|
4
|
+
*
|
|
5
|
+
* @param a
|
|
6
|
+
* @param b
|
|
7
|
+
*/
|
|
2
8
|
export declare const absDiff: FnN2;
|
|
9
|
+
/**
|
|
10
|
+
* Similar to `Math.sign()`, but uses `eps` to determine the zero value (i.e. if
|
|
11
|
+
* `x` is in [-eps,eps] interval).
|
|
12
|
+
*
|
|
13
|
+
* @param x
|
|
14
|
+
* @param eps
|
|
15
|
+
*/
|
|
3
16
|
export declare const sign: (x: number, eps?: number) => 0 | 1 | -1;
|
|
17
|
+
/**
|
|
18
|
+
* Raises `x` to `k` power and multiplies it with the {@link sign} of `x`, using
|
|
19
|
+
* `eps` to determine zero.
|
|
20
|
+
*
|
|
21
|
+
* @param x
|
|
22
|
+
* @param k
|
|
23
|
+
* @param eps
|
|
24
|
+
*/
|
|
25
|
+
export declare const signedPow: (x: number, k: number, eps?: number) => number;
|
|
4
26
|
//# sourceMappingURL=abs.d.ts.map
|
package/abs.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { EPS } from "./api.js";
|
|
2
|
-
const absDiff = (
|
|
2
|
+
const absDiff = (a, b) => Math.abs(a - b);
|
|
3
3
|
const sign = (x, eps = EPS) => x > eps ? 1 : x < -eps ? -1 : 0;
|
|
4
|
+
const signedPow = (x, k, eps = EPS) => sign(x, eps) * Math.abs(x) ** k;
|
|
4
5
|
export {
|
|
5
6
|
absDiff,
|
|
6
|
-
sign
|
|
7
|
+
sign,
|
|
8
|
+
signedPow
|
|
7
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/math",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.0",
|
|
4
4
|
"description": "Assorted common math functions & utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"test": "bun test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@thi.ng/api": "^8.9.
|
|
41
|
+
"@thi.ng/api": "^8.9.18"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@microsoft/api-extractor": "^7.39.0",
|
|
@@ -138,5 +138,5 @@
|
|
|
138
138
|
"thi.ng": {
|
|
139
139
|
"year": 2013
|
|
140
140
|
},
|
|
141
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "7426e2ae6fca5482c6eaf649872296fc89955374\n"
|
|
142
142
|
}
|