@algorithm.ts/gcd 1.0.21 → 2.0.0-alpha.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/README.md CHANGED
@@ -72,6 +72,11 @@ A typescript implementation of the **gcd** and **Extended Euclidean** algorithm.
72
72
  yarn add @algorithm.ts/gcd
73
73
  ```
74
74
 
75
+ * deno
76
+
77
+ ```typescript
78
+ import { gcd, euclidean } from 'https://raw.githubusercontent.com/guanghechen/algorithm.ts/main/packages/gcd/src/index.ts'
79
+ ```
75
80
 
76
81
  ## Usage
77
82
 
package/lib/cjs/index.js CHANGED
@@ -8,7 +8,6 @@ function gcd(x, y) {
8
8
  function gcdBigint(x, y) {
9
9
  return y === 0n ? x : gcdBigint(y, x % y);
10
10
  }
11
-
12
11
  function euclidean(a, b) {
13
12
  let x;
14
13
  let y;
package/lib/esm/index.js CHANGED
@@ -4,7 +4,6 @@ function gcd(x, y) {
4
4
  function gcdBigint(x, y) {
5
5
  return y === 0n ? x : gcdBigint(y, x % y);
6
6
  }
7
-
8
7
  function euclidean(a, b) {
9
8
  let x;
10
9
  let y;
@@ -1,2 +1,35 @@
1
- export * from './gcd';
2
- export * from './euclidean';
1
+ /**
2
+ * Find the greatest common divisor of x and y
3
+ *
4
+ * @param x
5
+ * @param y
6
+ * @returns
7
+ */
8
+ export declare function gcd(x: number, y: number): number;
9
+ /**
10
+ * Bigint version.
11
+ *
12
+ * @param x
13
+ * @param y
14
+ * @returns
15
+ */
16
+ export declare function gcdBigint(x: bigint, y: bigint): bigint;
17
+ /**
18
+ * Extended Euclidean algorithm for solving the smallest
19
+ * integer solution (|x| + |y| smallest) of the equation `Ax + By = gcd(x,y)`.
20
+ *
21
+ * @param a
22
+ * @param b
23
+ * @returns
24
+ * @see https://me.guanghechen.com/post/math/number-theory/%E6%A8%A1%E6%96%B9%E7%A8%8B/basic/
25
+ */
26
+ export declare function euclidean(a: number, b: number): [number, number, number];
27
+ /**
28
+ * Bigint version.
29
+ *
30
+ * @param a
31
+ * @param b
32
+ * @returns
33
+ * @see https://me.guanghechen.com/post/math/number-theory/%E6%A8%A1%E6%96%B9%E7%A8%8B/basic/
34
+ */
35
+ export declare function euclideanBigint(a: bigint, b: bigint): [bigint, bigint, bigint];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algorithm.ts/gcd",
3
- "version": "1.0.21",
3
+ "version": "2.0.0-alpha.0",
4
4
  "description": "GCD + Euclidean algorithm",
5
5
  "author": {
6
6
  "name": "guanghechen",
@@ -40,5 +40,5 @@
40
40
  "prepublishOnly": "cross-env ROLLUP_SHOULD_SOURCEMAP=false yarn build",
41
41
  "test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
42
42
  },
43
- "gitHead": "610f21c513a5d0dce5afc2ad315a525c17300409"
43
+ "gitHead": "f48a558ad6decd6c5eee4b9a999ac085c9e19a22"
44
44
  }
@@ -1,19 +0,0 @@
1
- /**
2
- * Extended Euclidean algorithm for solving the smallest
3
- * integer solution (|x| + |y| smallest) of the equation `Ax + By = gcd(x,y)`.
4
- *
5
- * @param a
6
- * @param b
7
- * @returns
8
- * @see https://me.guanghechen.com/post/math/number-theory/%E6%A8%A1%E6%96%B9%E7%A8%8B/basic/
9
- */
10
- export declare function euclidean(a: number, b: number): [number, number, number];
11
- /**
12
- * Bigint version.
13
- *
14
- * @param a
15
- * @param b
16
- * @returns
17
- * @see https://me.guanghechen.com/post/math/number-theory/%E6%A8%A1%E6%96%B9%E7%A8%8B/basic/
18
- */
19
- export declare function euclideanBigint(a: bigint, b: bigint): [bigint, bigint, bigint];
@@ -1,16 +0,0 @@
1
- /**
2
- * Find the greatest common divisor of x and y
3
- *
4
- * @param x
5
- * @param y
6
- * @returns
7
- */
8
- export declare function gcd(x: number, y: number): number;
9
- /**
10
- * Bigint version.
11
- *
12
- * @param x
13
- * @param y
14
- * @returns
15
- */
16
- export declare function gcdBigint(x: bigint, y: bigint): bigint;