@algorithm.ts/gcd 1.0.23 → 2.0.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/README.md +5 -0
- package/lib/cjs/index.js +0 -1
- package/lib/esm/index.js +0 -1
- package/lib/types/index.d.ts +35 -2
- package/package.json +2 -2
- package/lib/types/euclidean.d.ts +0 -19
- package/lib/types/gcd.d.ts +0 -16
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
package/lib/esm/index.js
CHANGED
package/lib/types/index.d.ts
CHANGED
|
@@ -1,2 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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": "
|
|
3
|
+
"version": "2.0.1",
|
|
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": "
|
|
43
|
+
"gitHead": "cac97b1cbdc95e0c0914b24ea4e4d25e40bb15c5"
|
|
44
44
|
}
|
package/lib/types/euclidean.d.ts
DELETED
|
@@ -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];
|
package/lib/types/gcd.d.ts
DELETED
|
@@ -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;
|