Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions paper/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Error bounds for quad-double style arithmetic on floating-point expansions of any length

[expansion-error-bounds.pdf](expansion-error-bounds.pdf) proves error bounds for the quad-double style algorithms of
Hida, Li and Bailey carried to any number of parts, the algorithms `src/od.rs` runs at eight. Sums and products err by
at most u^n times the exact result plus a second term, at most 2^-15 of the first at eight parts in binary64. Simple
inputs reach the bound. A sum of K products accumulated in levels, as `OdAcc` does, errs by u^n times the exact sum
plus a term that grows like (Ku)^(n+1), and constructed inputs show the growth. The exponential and the logarithm, built from these
operations with part bounds carried through every step, err by at most 3.661 u^8 e^x + 2^-1071 and 9.926 u^8 |ln x| +
2^-509; the logarithm starts from a binary64 logarithm whose error is proved too.
[expansion-error-bounds.pdf](expansion-error-bounds.pdf) proves error bounds for a level scheme in the style of Hida, Li
and Bailey's quad-double algorithms, with TwoSum throughout, at any number of parts: the algorithms `src/od.rs` runs at
eight. It is not the QD library's own code at four parts, and Section II of the paper lists the differences. Sums and
products err by at most u^n times the exact result plus a second term of at most 2^-15 u^n times the operands' leading
parts, |a_0| + |b_0| for a sum and |a_0 b_0| for a product, at eight parts in binary64. Simple inputs reach the bound. A
sum of K products accumulated in levels, as `OdAcc` does, errs by u^n times the exact sum plus a term that grows like
(Ku)^(n+1) times the sum of the products' |a_0 b_0|, and constructed inputs show the growth. The sloppy multiply,
without the last level, errs by at most 2^31.93 u^8 |a_0 b_0|. The sine and cosine err by at most 3.17 u^8 and the
tangent by 6.42 u^8 relative, each with a term from the reduction's 1216 bits of pi/2. The exponential and the
logarithm, built from these operations with part bounds carried through every step, err by at most 3.661 u^8 e^x +
2^-1071 and 9.926 u^8 |ln x| + 2^-509; the logarithm starts from a binary64 logarithm whose error is bounded too. Each
constant is computed by a script of this folder from a proved recursion and printed rounded up.

| File | Contents |
|---|---|
Expand Down
14 changes: 7 additions & 7 deletions paper/expansion-error-bounds-appendix.tex
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ \section{Error bounds for the operations}

\begin{table}[tp]
\centering
\caption{Theorem~\ref{thm:t3} at $n = 8$, $p = 53$. In units of $2^{-418}$, the leading term is $1/64$ unit. Below each row, the bound for $\theta = 2$.}
\caption{Theorem~\ref{thm:t3} at $n = 8$, $p = 53$ (computed, \texttt{constants.py}). In units of $2^{-418}$, the leading term is $1/64$ unit. Below each row, the bound for $\theta = 2$.}
\label{tab:kappa}
\small
\begin{tabular}{@{}lcc@{}}
Expand Down Expand Up @@ -443,8 +443,8 @@ \section{Error bounds for the operations}
\end{proof}

After cancellation in ADD or ADDF, $M/|x_0|$ is unbounded, and Theorem~\ref{thm:t5} bounds the parts relative to $M$
only. A subtraction of nearly equal values, as in the remainders of long division, can therefore leave a result
outside $H(2)$, and the theorems above do not chain through it.
only. A subtraction of nearly equal values, as in the remainders of long division, is therefore not shown to return a result
in $H(2)$, and the theorems above do not chain through it.

\section{Division}

Expand Down Expand Up @@ -484,7 +484,7 @@ \section{Division}
\Bigl|\frac ab - \sum_k x_k\Bigr| \le (u^n + \kdiv u^{n+1})\Bigl|\frac ab\Bigr|, \\
\kdiv = \frac{(1+u^n)\Theta\frac{1-\rho}{1-2\rho} + \Xi}{(1-2\rho)\,u^{n+1}}.
\end{gather*}
At $n = 8$, $p = 53$: $\kdiv \le 2^{26.0}$ for $\theta = 1$ and $\kdiv \le 2^{27.48}$ for $\theta = 2$, so $|a/b - x| \le (1 +
At $n = 8$, $p = 53$ (computed, \texttt{div\_consts.py}): $\kdiv \le 2^{26.0}$ for $\theta = 1$ and $\kdiv \le 2^{27.48}$ for $\theta = 2$, so $|a/b - x| \le (1 +
2^{-25.5})\,2^{-424}|a/b|$ for ulp-nonoverlapping $a$ and $b$.
\end{theorem}

Expand Down Expand Up @@ -527,7 +527,7 @@ \section{Division}
\begin{remark}
The bound on the remainders grows by about $7u$ per update at $\theta = 2$ ($P^{(k)}_0 \approx 6.7^k u^k$ at $n = 8$),
so $\kdiv$ grows like $7^{n+1}$ times the cost of an update, and $\kdiv u < 1$ for $n \le 13$ at $p = 53$
($\kdiv u \le 2^{-8.1}$ at $n = 12$ and $2^{-3.4}$ at $n = 13$, $\theta = 2$). The remainders after cancellation do not satisfy $H(\theta)$ for a useful
($\kdiv u \le 2^{-8.1}$ at $n = 12$ and $2^{-3.4}$ at $n = 13$, $\theta = 2$). The remainders after cancellation are not shown to satisfy $H(\theta)$ for a useful
$\theta$, so the proof carries part bounds $P^{(k)}$ relative to $|a_0|$ through Lemma~\ref{lem:o} instead of applying
Theorem~\ref{thm:t3} to each update. The leading constant 1 is attained (Proposition~\ref{prop:sharp}(d)).
\end{remark}
Expand Down Expand Up @@ -561,7 +561,7 @@ \section{The square root}
&\quad + \epsilon_d + \epsilon_r, \qquad \pi^{(k+1)} = \pi'.
\end{align*}
With $(\epsilon_z, \cdot) = G_{\rm MUL}(\pi^{(J)}, \bar a;\ 1 + E_J)$ and $\delta_J = E_J + \epsilon_z$, the result
satisfies $|\sqrt x - \sum_k \mathrm{SQRT}(x)_k| \le \delta_J\sqrt x$. At $n = 8$, $J = 4$, $p = 53$: $\delta_4 \le
satisfies $|\sqrt x - \sum_k \mathrm{SQRT}(x)_k| \le \delta_J\sqrt x$. At $n = 8$, $J = 4$, $p = 53$ (computed, \texttt{sqrt\_consts.py}): $\delta_4 \le
3.0000319\,u^8$ for $\theta = 2$ and $3.0000198\,u^8$ for $\theta = 1$.
\end{theorem}

Expand Down Expand Up @@ -626,7 +626,7 @@ \section{The square root}
\end{align*}
Let $E_2$ and $\pi^{(2)}$ be one step of Theorem~\ref{thm:t7} from $E_1$ and $\pi^{(1)}$, $(\epsilon_z, \cdot) =
G_{\rm MUL}(\pi^{(2)}, \bar a;\ 1 + E_2)$ and $\delta^{\rm DD} = E_2 + \epsilon_z$. Then $|\sqrt x - \sum_k
\mathrm{SQRT}^{\rm DD}_n(x)_k| \le \delta^{\rm DD}\sqrt x$. At $n = 8$, $p = 53$: $E_0 \le 22.125\,u^2 + 72\,u^3$ for
\mathrm{SQRT}^{\rm DD}_n(x)_k| \le \delta^{\rm DD}\sqrt x$. At $n = 8$, $p = 53$ (computed, \texttt{sqrt\_consts.py}): $E_0 \le 22.125\,u^2 + 72\,u^3$ for
$\theta = 2$ and $19.125\,u^2 + 58\,u^3$ for $\theta = 1$, $E_1 \le 2^{-303}$, and
$\delta^{\rm DD} \le 3.0000319\,u^8$ for $\theta = 2$ and $3.0000198\,u^8$ for $\theta = 1$, the bounds of SQRT$_{8,4}$.
\end{theorem}
Expand Down
10 changes: 6 additions & 4 deletions paper/expansion-error-bounds-explog.tex
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ \section{The exponential and the logarithm}\label{sec:explog}
\]
If the cases cover every $|r|$ that can select each $e$, $|y - e^x| \le \varepsilon_{\exp}e^x + n2^{-1074}$, with
$\varepsilon_{\exp}$ the largest $\varepsilon$; the second term arises only where the result's parts fall below
$2^{-1022}$. At $n = 8$, $s = 6$, $d = 43$ and $\theta = 2$, $\varepsilon_{\exp} \le 3.661\,u^8$, the largest at $k
\ne 0$, $m = 5$, $r$ just above $-\frac12\ln 2$.
$2^{-1022}$. At $n = 8$, $s = 6$, $d = 43$ and $\theta = 2$ (computed, \texttt{explog\_consts.py}), $\varepsilon_{\exp} \le
3.661\,u^8$, the largest at $k \ne 0$, $m = 5$, $r$ just above $-\frac12\ln 2$.
\end{theorem}

\begin{proof}
Expand Down Expand Up @@ -239,7 +239,8 @@ \section{The exponential and the logarithm}\label{sec:explog}
\end{itemize}
Then $|y - \ln x| \le \mathcal E(\ell)$ in the case of the run. With $\varepsilon_{\ln}$ and $\Phi$ defined from
$\mathcal E$ in the proof, $|y - \ln x| \le \varepsilon_{\ln}|\ln x| + \Phi$, and at $n = 8$, $s = 6$, $d = 43$, $q
= 4$ and $\theta = 2$, $\varepsilon_{\ln} \le 9.926\,u^8$ and $\Phi \le 2^{-509}$.
= 4$ and $\theta = 2$ (computed, \texttt{explog\_consts.py}), $\varepsilon_{\ln} \le 9.926\,u^8$ and $\Phi \le
2^{-509}$.
\end{theorem}

\begin{proof}
Expand Down Expand Up @@ -330,7 +331,8 @@ \section{The exponential and the logarithm}\label{sec:explog}
\mu = \RN(\sqrt 2)$, $m \gets m/2$ and $e \gets e + 1$; $s = \RN((m - 1)/\RN(m + 1))$ and $z = \RN(s^2)$; $v \gets
c_9$ and $v \gets \RN(zv + c_j)$, a fused multiply-add, for $j = 8, \dots, 0$, with $c_j = \RN(1/(2j+1))$; and return
$\RN(ec_{\rm L} + \RN(2sv))$, a fused multiply-add, with $c_{\rm L} = \RN(\ln 2)$. Then $\ln_{\rm b}(1) = 0$ and
$|\ln_{\rm b}(h) - \ln h| \le \eta_{\rm b}|\ln h|$ with $\eta_{\rm b} = 5.915\,u$ ($2^{-50.43}$). This is
$|\ln_{\rm b}(h) - \ln h| \le \eta_{\rm b}|\ln h|$ with $\eta_{\rm b} = 5.915\,u$ ($2^{-50.43}$; computed,
\texttt{explog\_consts.py}). This is
multidouble's \texttt{ln\_f64}.
\end{lemma}

Expand Down
2 changes: 1 addition & 1 deletion paper/expansion-error-bounds-sloppy.tex
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ \section{The sloppy multiply}\label{sec:sloppy}
Theorem~\ref{thm:acc} with $\tau_l = \max(L_lu^l, \rho^l)$ for $l < n$, $\tau_n = 0$, and $E_{\rm prod} =
(R_{\rm s} + \Delta_nu)u^nW$.
\end{enumerate}
At $n = 8$ and $p = 53$, $Q = 64$, and $R_{\rm s} + \Delta_8u \le 2^{30.4117}$ for $\theta = 1$ and $2^{31.9242}$ for
At $n = 8$ and $p = 53$ (computed, \texttt{sloppy\_consts.py}), $Q = 64$, and $R_{\rm s} + \Delta_8u \le 2^{30.4117}$ for $\theta = 1$ and $2^{31.9242}$ for
$\theta = 2$, of which $\Delta_8u$ is at most $2^{-50.41}$ and $2^{-41.41}$.
\end{theorem}

Expand Down
2 changes: 1 addition & 1 deletion paper/expansion-error-bounds-trig.tex
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ \section{Sine, cosine and tangent}\label{sec:trig}
|\mathrm{COS}_n(x) - \cos x| \le C|\cos x| + 5E_\pi, \\
|\mathrm{TAN}_n(x) - \tan x| \le \Bigl(C^{\rm T} + \frac{5E_\pi}{|\sin x\cos x|}\Bigr)|\tan x|.
\end{gather*}
At $n = 8$, $C \le 3.163168\,u^8$ and $C^{\rm T} \le 6.418351\,u^8$. With the double-word bounds of DWTimesDW3,
At $n = 8$ (computed, \texttt{trig\_consts.py}), $C \le 3.163168\,u^8$ and $C^{\rm T} \le 6.418351\,u^8$. With the double-word bounds of DWTimesDW3,
$(4u^2 + u^3/2)/(1+u)^2$ \cite{MR22}, AccurateDWPlusDW, $3u^2/(1-4u)$, DWPlusFP, $2u^2$, and DWDivDW2, $15u^2 +
56u^3$ \cite{JMP17}, in place of Lemma~\ref{lem:g} and Theorem~\ref{thm:t6}, the bounds hold for multidouble's
double-double functions of a double-word $x$ ($x_0 = \RN(x)$) with $C \le 7.841412\,u^2$ and $C^{\rm T} \le
Expand Down
Binary file modified paper/expansion-error-bounds.pdf
Binary file not shown.
Loading
Loading