* Count matching significant digits between two numeric strings. * Returns the number of leading digits that agree.
(a: string, b: string)
| 32 | * Returns the number of leading digits that agree. |
| 33 | */ |
| 34 | function matchingDigits(a: string, b: string): number { |
| 35 | const da = sigDigits(a); |
| 36 | const db = sigDigits(b); |
| 37 | const len = Math.min(da.length, db.length); |
| 38 | for (let i = 0; i < len; i++) { |
| 39 | if (da[i] !== db[i]) return i; |
| 40 | } |
| 41 | return len; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Compute factorial as a BigDecimal string. |
no test coverage detected