Exact Short Products From Truncated Multipliers
Daniel Lemire
TL;DR
This work addresses computing the $d$ most significant digits of a product when the multiplier is large or irrational and only its leading digits are accessible. It derives an exact-ness criterion for short multipliers: the discarded remainder must satisfy $( w z) \% M < M - w + 1$ to ensure exact MSDs for the range of interest. The authors develop a logarithmic-time algorithm that enumerates extrema of the remainders $(w z) \% M$ and extends it to offsets, enabling efficient computation of the valid $w$-range via a final find_range procedure. The methods are implemented in an open-source Python library, enabling precise, storage-efficient digit extraction with potential impact on parsing, numeric representations, and cryptography.
Abstract
We sometimes need to compute the most significant digits of the product of small integers with a multiplier requiring much storage: e.g., a large integer (e.g., $5^{100}$) or an irrational number ($π$). We only need to access the most significant digits of the multiplier-as long as the integers are sufficiently small. We provide an efficient algorithm to compute the range of integers given a truncated multiplier and a desired number of digits.
