@thi.ng/math 5.7.12 → 5.8.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-01-23T15:58:27Z
3
+ - **Last updated**: 2024-01-29T20:39:37Z
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
@@ -7,9 +7,13 @@
7
7
  ![npm downloads](https://img.shields.io/npm/dm/@thi.ng/math.svg)
8
8
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
9
9
 
10
- This is a standalone project, maintained as part of the
11
- [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo and
12
- anti-framework.
10
+ > [!NOTE]
11
+ > This is one of 189 standalone projects, maintained as part
12
+ > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
13
+ > and anti-framework.
14
+ >
15
+ > 🚀 Help me to work full-time on these projects by [sponsoring me on
16
+ > GitHub](https://github.com/sponsors/postspectacular). Thank you! ❤️
13
17
 
14
18
  For the Clojure version, please visit: [thi.ng/math-clj](https://thi.ng/math-clj)
15
19
 
@@ -68,7 +72,7 @@ For Node.js REPL:
68
72
  const math = await import("@thi.ng/math");
69
73
  ```
70
74
 
71
- Package sizes (brotli'd, pre-treeshake): ESM: 4.07 KB
75
+ Package sizes (brotli'd, pre-treeshake): ESM: 4.09 KB
72
76
 
73
77
  ## Dependencies
74
78
 
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 = (x, y) => Math.abs(x - y);
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.7.12",
3
+ "version": "5.8.1",
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.17"
41
+ "@thi.ng/api": "^8.9.19"
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": "417b5a7ea7bd54a3b4f086fe0fc2ce8e8933c9b2\n"
141
+ "gitHead": "20909ffc46f23f61ec7647e8d27ed17752ce9828\n"
142
142
  }