Table of Contents
Fetching ...

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.

Exact Short Products From Truncated Multipliers

TL;DR

This work addresses computing the 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 to ensure exact MSDs for the range of interest. The authors develop a logarithmic-time algorithm that enumerates extrema of the remainders and extends it to offsets, enabling efficient computation of the valid -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., ) 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.
Paper Structure (13 sections, 3 theorems, 1 equation, 4 figures, 3 tables)

This paper contains 13 sections, 3 theorems, 1 equation, 4 figures, 3 tables.

Key Result

lemma 1

Let $z$ be a truncated integer multiplier and $z'=z + \epsilon$ be the exact multiplier with $\epsilon \in [0,1)$. For integers $w$ and $M$, we have that $( w \times z) \div M = ( w \times z') \div M$ for all $\epsilon$ if and only if $(w\times z) \mathop{\mathrm{\mathbin{\%}}}\nolimits M < M - w +

Figures (4)

  • Figure 1: Illustration of how the next extrema is computed from the last minimum and the last maximum
  • Figure 2: Python code to compute all of the gaps between the extrema of $(w \times z)\mathop{\mathrm{\mathbin{\%}}}\nolimits M$ for $w=1,2,\ldots, \frac{M}{\gcd(z,M)} - 1$. $M$ and $z$ should be positive integers, and $z$ should not be a multiple of $M$.
  • Figure 3: Python code to enumerate all extrema of $(w\times z) \mathop{\mathrm{\mathbin{\%}}}\nolimits M$ for $w = A,\ldots, B$. $M$ and $z$ should be positive integers, and $z$ should not be a multiple of $M$.
  • Figure 4: Python code to compute the range of values of $w$ for which the most significant digits of $w\times z$ are exact even if $z$ is truncated. The function allows the user to specify the number of exact most-significant digits desired (digits) as well as the basis (base).

Theorems & Definitions (6)

  • lemma 1
  • proof
  • lemma 2
  • proof
  • lemma 3
  • proof