(n: number)
| 661 | } |
| 662 | |
| 663 | function toScientificInteger(n: number): readonly [coefficient: bigint, exponent: number] { |
| 664 | const scientific = Math.abs(n).toExponential() |
| 665 | const eIndex = scientific.indexOf("e") |
| 666 | const digits = scientific.slice(0, eIndex).replace(".", "") |
| 667 | const coefficient = BigInt(digits) * (n < 0 ? -BigInt(1) : BigInt(1)) |
| 668 | return [coefficient, globalThis.Number(scientific.slice(eIndex + 1)) - digits.length + 1] |
| 669 | } |
| 670 | |
| 671 | /** |
| 672 | * Returns the next power of 2 from the given number. |
no test coverage detected