* Exact Bernoulli numbers and exact values of the Riemann zeta function at * integers, computed with bigint rationals. * * Used by the exact (non-numericApproximation) evaluation path of `Zeta` * in `library/arithmetic.ts`: * * - ζ(2k) = (−1)^{k+1} · B₂ₖ · (2π)^{2k} / (2·(2k)!) → rational ·
(a: bigint, b: bigint)
| 14 | */ |
| 15 | |
| 16 | function gcd(a: bigint, b: bigint): bigint { |
| 17 | if (a < 0n) a = -a; |
| 18 | if (b < 0n) b = -b; |
| 19 | while (b !== 0n) [a, b] = [b, a % b]; |
| 20 | return a; |
| 21 | } |
| 22 | |
| 23 | function reduce(num: bigint, den: bigint): [bigint, bigint] { |
| 24 | if (den < 0n) { |