extra-math 1.2.4 → 1.2.5

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/index.d.ts CHANGED
@@ -2,18 +2,21 @@
2
2
  * Find the remainder of x/y with sign of x (truncated division).
3
3
  * @param x dividend
4
4
  * @param y divisor
5
+ * @returns trunc(x/y)
5
6
  */
6
7
  declare function rem(x: number, y: number): number;
7
8
  /**
8
9
  * Find the remainder of x/y with sign of y (floored division).
9
10
  * @param x dividend
10
11
  * @param y divisor
12
+ * @returns floor(x/y)
11
13
  */
12
14
  declare function mod(x: number, y: number): number;
13
15
  /**
14
16
  * Find the remainder of x/y with +ve sign (euclidean division).
15
17
  * @param x dividend
16
18
  * @param y divisor
19
+ * @returns n>0: floor(x/y), n<0: ceil(x/y)
17
20
  */
18
21
  declare function modp(x: number, y: number): number;
19
22
  /**
@@ -40,12 +43,12 @@ declare function factorial(x: number, k?: number): number;
40
43
  */
41
44
  declare function binomial(n: number, k: number): number;
42
45
  /**
43
- * TODO: Find the number of ways to put n objects in m bins (n=sum(ki)).
44
- * @param k objects per bin (ki)
46
+ * Find the number of ways to put n objects in m bins (n=sum(kᵢ)).
47
+ * @param ks objects per bin (kᵢ)
45
48
  */
46
- declare function multinomial(...k: number[]): number;
49
+ declare function multinomial(...ks: number[]): number;
47
50
  /**
48
- * Constrain a number within a minimum and maximum value.
51
+ * Constrain a number within a minimum and a maximum value.
49
52
  * @param x a number
50
53
  * @param min minimum value
51
54
  * @param max maximum value
@@ -60,7 +63,7 @@ declare function constrain(x: number, min: number, max: number): number;
60
63
  */
61
64
  declare function root(x: number, n: number): number;
62
65
  /**
63
- * TODO: (log?) Find the logarithm of a number with a given base.
66
+ * Find the logarithm of a number with a given base.
64
67
  * @param x a number
65
68
  * @param b logarithm base
66
69
  * @returns log_b (x)
package/index.js CHANGED
@@ -45,11 +45,11 @@ function binomial(n, k) {
45
45
  a *= n / i;
46
46
  return a;
47
47
  }
48
- function multinomial(...k) {
49
- var n = sum(...k), a = 1;
50
- for (var i = 0, j = 0, I = k.length; i < I;) {
48
+ function multinomial(...ks) {
49
+ var n = sum(...ks), a = 1;
50
+ for (var i = 0, j = 0, I = ks.length; i < I;) {
51
51
  if (j <= 0)
52
- j = k[i++];
52
+ j = ks[i++];
53
53
  else
54
54
  a *= n-- / j--;
55
55
  }
package/index.mjs CHANGED
@@ -41,11 +41,11 @@ function binomial(n, k) {
41
41
  a *= n / i;
42
42
  return a;
43
43
  }
44
- function multinomial(...k) {
45
- var n = sum(...k), a = 1;
46
- for (var i = 0, j = 0, I = k.length; i < I;) {
44
+ function multinomial(...ks) {
45
+ var n = sum(...ks), a = 1;
46
+ for (var i = 0, j = 0, I = ks.length; i < I;) {
47
47
  if (j <= 0)
48
- j = k[i++];
48
+ j = ks[i++];
49
49
  else
50
50
  a *= n-- / j--;
51
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extra-math",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "Mathematics is the classification and study of all possible patterns.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",