(n: bigint, degree: number)
| 654 | |
| 655 | // A root of magnitude at most one is exact only when it equals `n`, which avoids raising it to a huge degree. |
| 656 | const exactRoot = (n: bigint, degree: number): Option.Option<bigint> => |
| 657 | Option.filter(BI.nthRoot(n, degree), (r) => (BI.abs(r) <= bigint1 ? r : r ** BigInt(degree)) === n) |
| 658 | |
| 659 | /** |
| 660 | * Takes the exact n-th root of a rational, returning `Option.none()` when the |
no test coverage detected