(a: number, b: number)
| 197 | //https://github.com/Yaffle/bigint-gcd/blob/main/gcd.js |
| 198 | if (!Number.isInteger(a) || !Number.isInteger(b)) return NaN; |
| 199 | while (b !== 0) [a, b] = [b, a % b]; |
| 200 | return a < 0 ? -a : a; |
| 201 | } |
| 202 | /* |
| 203 | Consider implementing a Binary GCD algorithm. |
| 204 | Performance is not necessarily better, so benchmark before adopting. |
| 205 | |
| 206 | var gcd = function (a, b) { |
| 207 | if (a === 0) return b; |
| 208 | if (b === 0) return a; |
| 209 | if (a === b) return a; |