proof

Revision en2, by platelet, 2023-01-17 18:15:12

proof of this

Theorem: Let $$$p=\lceil\frac km\times2^{64}\rceil$$$, when $$$a_i\le \frac{2^{64}}m$$$, the computation of the lower rounding is exact.

Proof: Let $$$\frac p{2^{64}}=\frac km+\epsilon$$$, where $$$\epsilon\in[0,\frac1{2^{64}})$$$.

$$$ \begin{aligned} \lfloor\{a_i\times \frac p{2^{64}}\}\times m\rfloor&=\lfloor\{a_i\times (\frac km+\epsilon)\}\times m\rfloor\\ &=\lfloor\{a_i\times \frac km+a_i\epsilon\}\times m\rfloor \end{aligned} $$$

Here if $$$\lfloor a_i\times\frac km+a_i\epsilon\rfloor>\lfloor a_i\times \frac km\rfloor$$$ must be wrong, $$$a_i\times \frac km$$$ is at least $$$\frac1m$$$ away from $$$\lfloor a_i\times \frac km\rfloor+1$$$, so as long as $$$a_i\epsilon<\frac1m$$$ it's OK, let's continue the derivation.

$$$ \begin{aligned} &=\lfloor\{a_i\times \frac km+a_i\epsilon\}\times m\rfloor\\ &=\big\lfloor\left(\{a_i\times \frac km\}+a_i\epsilon\right)m\big\rfloor\\ &=\lfloor\{a_i\times \frac km\}\times m+a_im\epsilon\rfloor \end{aligned} $$$

Since $$$\{a_i\times\frac km\}\times m$$$ is an integer, the result is exact as long as $$$a_im\epsilon<1$$$.

The $$$a_i\epsilon<\frac1m$$$ and $$$a_im\epsilon<1$$$ are the same, and then the condition can be rewritten as $$$a_i\le\frac{2^{64}}m$$$ according to $$$\epsilon<\frac1{2^{64}}$$$.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English platelet 2023-01-17 18:15:12 61
en1 English platelet 2023-01-17 17:45:37 1236 Initial revision (published)