1\documentclass[a4paper,10pt,twoside]{article}
2
3\usepackage{a4wide}
4\usepackage[latin1]{inputenc}
5\usepackage[T1]{fontenc}
6\usepackage{url}
7
8\usepackage{amstext,latexsym,amsfonts,amssymb}
9
10
11
12
13\newcommand{\http}{http://}
14\newtheorem{theorem}{Theorem}[section]
15\newtheorem{lemma}[theorem]{Lemma}
16\newtheorem{proposition}[theorem]{Proposition}
17\newtheorem{corollary}[theorem]{Corollary}
18\newtheorem{definition}[theorem]{Definition}
19\newtheorem{algorithm}[theorem]{Algorithm}
20\newenvironment{proof}[1][Proof]{\begin{trivlist}
21\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
22\newcommand{\qed}{\nobreak \ifvmode \relax \else \ifdim \lastskip<1.5em \hskip-\lastskip
23\hskip1.5em plus0em minus0.5em \fi \nobreak \vrule height0.75em width0.5em depth0.25em\fi}
24\newcommand{\N}{\ensuremath{\mathbb {N}}}
25\newcommand{\Z}{\ensuremath{\mathbb {Z}}}
26\newcommand{\F}{\ensuremath{\mathbb {F}}}
27\newcommand{\R}{\ensuremath{\mathbb {R}}}
28\newcommand{\hi}{\ensuremath{\mathit{h}}}
29\newcommand{\mi}{\ensuremath{\mathit{m}}}
30\newcommand{\lo}{\ensuremath{\mathit{l}}}
31\newcommand{\E}{\ensuremath{\mathcal{E}}}
32\newcommand{\ouvguill}{``}
33\newcommand{\fermguill}{''}
34\newcommand{\Add}{{\bf Add12}}
35\newcommand{\AddDD}{{\bf Add22}}
36\newcommand{\AddDTT}{{\bf Add233}}
37\newcommand{\AddTT}{{\bf Add33}}
38\newcommand{\MulDT}{{\bf Mul23}}
39\newcommand{\Mul}{{\bf Mul12}}
40\newcommand{\MulDD}{{\bf Mul22}}
41\newcommand{\MulDTT}{{\bf Mul233}}
42\newcommand{\mAdd}{\ensuremath{\mathbf{Add12}}}
43\newcommand{\mAddDD}{\ensuremath{\mathbf{Add22}}}
44\newcommand{\mAddDTT}{\ensuremath{\mathbf{Add233}}}
45\newcommand{\mAddTT}{\ensuremath{\mathbf{Add33}}}
46\newcommand{\mMul}{\ensuremath{\mathbf{Mul12}}}
47\newcommand{\mMulDD}{\ensuremath{\mathbf{Mul22}}}
48\newcommand{\mMulDT}{\ensuremath{\mathbf{Mul23}}}
49\newcommand{\mMulDTT}{\ensuremath{\mathbf{Mul233}}}
50\newcommand{\mUlp}{\ensuremath{\mathrm{ulp}}}
51\newcommand{\nan}{\ensuremath{\mathrm{NaN}}}
52\newcommand{\sgn}{\ensuremath{\mathrm{sgn}}}
53\renewcommand{\succ}{\ensuremath{\mathrm{succ}}}
54\newcommand{\pred}{\ensuremath{\mathrm{pred}}}
55\newcommand{\xor}{\ensuremath{\mbox{ }\mathrm{XOR}\mbox{ }}}
56\renewcommand{\epsilon}{\varepsilon}
57
58
59
60\title{Basic building blocks\\for a triple-double intermediate format\\{\small (corrected version)}}
61
62\author{Christoph Quirin Lauter}
63
64\date{\today}
65
66
67\begin{document}
68
69\maketitle
70
71\begin{abstract}
72The implementation of correctly rounded elementary functions needs high
73intermediate accuracy before final rounding. This accuracy can be provided by (pseudo-)
74expansions of size three, i.e. a triple-double format.
75
76The report presents all basic operators for such a format. Triple-double numbers can be
77redundant. A renormalization procedure is presented and proven. Elementary functions'
78implementations need addition and multiplication sequences. These operators must take
79operands in double, double-double and triple-double format. The results must be accordingly
80in one of the formats. Several procedures are presented. Proofs are given for their
81accuracy bounds.
82
83Intermediate triple-double results must finally be correctly rounded to double precision.
84Two effective rounding sequences are presented, one for round-to-nearest mode, one for
85the directed rounding modes. Their complete proofs constitute half of the report.
86\end{abstract}
87
88
89\section{Introduction}
90The implementation of correctly rounded double precision elementary functions needs high accuracy intermediate
91formats \cite{Muller97,Defour-thesis,crlibmweb,DinDefLau2004LIP}. To give an order of magnitude, in most cases
92$120$ bits of intermediate accuracy are needed for assuring the correct rounding property \cite{DinDefLau2004LIP}.
93In contrast, the native IEEE 754 double precision format offers $53$ bits of accuracy. Well-know techniques
94allow to double this accuracy \cite{Dek71}. Nevertheless the resulting accuracy, $106$ bits, is not sufficient.
95Tripling it would be enough.\par
96Using expansions of floating point numbers allows to expand still more the accuracy of a native floating point type.
97An expansion is a non-evaluated sum of some floating point numbers in a floating
98point format \cite{Finot-thesis, Pri91, She97}. However the techniques for manipulating general expansions presented
99in literature are too costly for the implementation of elementary functions.\par
100In this report, we are going to consider expansions of three double
101precision floating point numbers, i.e. we are going to investigate on a triple
102double format. In our case, we will hence manipulate floating
103point numbers $(x_\hi + x_\mi + x_\lo)$ with $x_\hi, x_\mi, x_\lo \in \F$.\par
104After making some definitions and an analysis of a procedure that we call
105renormalization, we will consider addition and multiplication procedures for
106triple-double numbers. These will also comprise operations linking the triple
107double format with the native double and a double-double format.\par
108In the end,
109we will present and prove in particular two final rounding sequences for correctly
110rounding a triple-double number to the base double format.
111\section{Definitions}
112It will be necessary to define a normal form of a triple-double number
113because it is clear that the triple-double floating point format - or that of
114(pseudo-)expansions in general - is redundant: there exist numbers
115$\hat{x}$ such that there are different triplets $(x_\hi ,x_\mi ,x_\lo ) \in \F^3$
116such that $\hat{x} = x_\hi + x_\mi + x_\lo$. It is easy to see that a
117representation in such a format is unique if the numbers forming the expansion
118are ordered by decreasing 0 and if the latter are such that there is
119no (binary) digit represented by two bits of the significands of two different
120numbers of the expansion. The sign bit has in this case the same role as an
121additional bit of the significant \cite{Finot-thesis}.\par
122As we will see, the need for a normal form for each triple-double number is
123not directly motivated by needs of the addition and multiplication operators
124we will have to define. As long as the latter operate correctly, i.e. between
125known error bounds, on numbers whose representation in a triple-double format is not unique, we are not
126obliged to recompute normal forms. On the other hand, when we want to round
127down such a higher precision number to a native double (in one of the
128different rounding modes), a normal form will be needed. If we could not
129provide one, we would assist to a explosion of different cases to be handled
130by the rounding sequence.\\
131Let us first define some notations that are needed for the analysis of numerical algorithms like
132the ones that we are going to consider.
133\begin{definition}[Predecessor and successor of a floating point number] \label{predsuccdef} ~\\
134Let be $x \in \F$ a floating point number. Let be $<$ the total ordering on $\F$. \\
135If $x$ is positive or zero we will design by $x^+$ the direct successor of $x$ in $\F$ with regard to $<$
136and we will notate $x^-$ its predecessor.\\
137If $x$ is negative we will design by $x^-$ the successor and by $x^+$ the predecessor of $x$.\\
138In any case, we will design by $\succ\left( x \right)$ the successor of $x$ in $\F$ with regard to $<$ and
139$\pred\left(x\right)$ its predecessor.
140\end{definition}
141This definition \ref{predsuccdef} is inspired by \cite{Defour-thesis}.
142\begin{definition}[Unit on the last place -- the $\mUlp$~ function] \label{defulp} ~ \\
143Let be $x \in \F$ a double precision number and let be $x^+$ its
144successor (resp. predecessor if $x$ is negative). \\
145So
146$$\mUlp \left( x \right) = \left \lbrace
147                   \begin{array}{lll} x^+ - x & \mbox{ if } & x \geq 0 \mbox{ and } x^+ \not = + \infty \\
148                     2 \cdot \mUlp\left( \frac{x}{2} \right) & \mbox{ if } & x \not = + \infty \mbox{ but } x^+ = + \infty\\
149                     \mUlp \left( -x \right) & \mbox{ if } & x < 0 \end{array} \right.$$
150\end{definition}
151This definition is inspired by \cite{Defour-thesis}, too. Compare \cite{Muller05INRIA}
152for further research on the subject of the $\mUlp$~ function.\\~\par
153Concerning the overlap we define finally:
154\begin{definition}[Overlap]\label{defoverlap}~\\
155Let $x_\hi, x_\lo \in \F$ be two non-subnormal double precision numbers. \\
156We will say that $x_\hi$ and $x_\lo$ overlap iff
157$$\left \vert x_\lo \right \vert \geq \mUlp\left( \left \vert x_\hi \right
158\vert \right)$$~\\
159Let be $x_\hi, x_\mi, x_\lo \in \F$ the components of a triple-double
160number. We will suppose that they are not subnormals.\\
161So, we will say that there is overlap iff
162$x_\hi$ and $x_\mi$ or $x_\mi$ and $x_\lo$ or $x_\hi$ and $x_\lo$ overlap.
163\end{definition}
164\begin{definition}[Normal form]~\\
165Let be $x_\hi, x_\mi, x_\lo \in \F$ three non-subnormal floating point numbers
166forming the triple-double number $x_\hi + x_\mi + x_\lo$. \\
167We will say that $x_\hi + x_\mi + x_\lo$ are in normal form iff there is no
168overlap between its components.
169Further, we will say that $x_\hi + x_\mi + x_\lo$ is normalised.
170\end{definition} \par
171Having made this definition, let us remark that it is deeply inspired by our
172direct needs and not by abstract analysises on how to represent real
173numbers. Anyway, the fact that an expansion is not overlapping is not a
174sufficient condition for its representing an unique floating point number.\par
175The implementation of addition and multiplication operators will be finally be
176based on computations on the components of the operands (or partial products
177in the case of a multiplication) followed by a final summing up for
178regaining the triple-double base format. As we do not statically know the
179magnitudes of the triple-double operands and its components, we will not be
180able to guarantee that in any case there will not be any overlap in the
181result. On the other hand, we strive to develop a renormalization sequence for
182recomputing normal forms. These will be handy, as we already said, for the
183final rounding and, if needed, i.e. if sufficiently good static bounds can not
184be given, before handing over a result as an operand to a following operation.
185Such a renormalization sequence must guarantee that for each triple-double in
186argument (if needed verifying some preconditions on an initial overlap), the
187triple-double number returned will be normalised and that the sum of the
188components for the first number is exactly the same as the one of the
189components of the latter.\par
190\begin{definition}[The \Add~ algorithm] \label{adddef} ~ \\
191Let {\bf A} be an algorithm taking as arguments two double precision numbers $x,y \in \F$ and
192returning two double precision floating point numbers $r_\hi, r_\lo \in \F$.\\
193We will call {\bf A} the \Add~ algorithm iff it verifies that\\
194\begin{itemize}
195\item $\forall x,y \in \F. r_\hi + r_\lo = x + y$
196\item $\forall x,y \in \F. \left \vert r_\lo \right \vert \leq 2^{-53} \cdot \left \vert r_\hi \right \vert$
197\item $r_\hi = \circ\left( x + y \right)$ \\
198$r_\lo = x + y - r_\hi$
199\end{itemize} ~\\
200i.e. iff it makes an exact addition of two floating point numbers such that
201the components of the double-double expansion in result are non-overlapping
202and if the most significant one is the floating point number nearest to the
203sum of the numbers in argument.
204\end{definition}
205\begin{definition}[The \Mul~ algorithm] \label{muldef} ~ \\
206Let {\bf A} be an algorithm taking as arguments two double precision numbers $x,y \in \F$ and
207returning two double precision floating point numbers $r_\hi, r_\lo \in \F$.\\
208We will call {\bf A} the \Mul~ algorithm iff it verifies that\\
209\begin{itemize}
210\item $\forall x,y \in \F. r_\hi + r_\lo = x \cdot y$
211\item $\forall x,y \in \F. \left \vert r_\lo \right \vert \leq 2^{-53} \cdot \left \vert r_\hi \right \vert$
212\item $r_\hi = \circ\left( x \cdot y \right)$ \\
213$r_\lo = x \cdot y - r_\hi$
214\end{itemize} ~\\
215i.e. iff it makes an exact multiplication of two floating point numbers such that
216the components of the double-double expansion in result are non-overlapping
217and if the most significant one is the floating point number nearest to the
218sum of the numbers in argument.
219\end{definition}
220We will pass over the existence proof of such algorithms. Consult \cite{Dek71} on this subject. \par
221Let us now give some main lemmas that can be deduced from the definition \ref{defulp} of the
222$\mUlp$~ function.
223\begin{lemma}[The $\mUlp$~ functions with regard to upper bounds] \label{ulpmajor} ~ \\
224Let be $x_\hi$ and $x_\lo$ two non-subnormal floating point numbers. \\
225So
226$$\left \vert x_\lo \right \vert < \mUlp\left( x_\hi \right) \Rightarrow
227\left \vert x_\lo \right \vert \leq 2^{-52} \cdot \left \vert x_\hi \right \vert$$
228\end{lemma}
229\begin{proof} ~ \\
230Let us suppose that $\left \vert x_\lo \right \vert < \mUlp\left(x_\hi
231\right)$ and that
232$\left \vert x_\lo \right \vert > 2^{-52} \cdot \left \vert x_\hi \right \vert$.\\
233So we get the following inequality
234$$2^{-52} \cdot \left \vert x_\hi \right \vert < \mUlp\left( x_\hi \right)$$
235Without loss of generality, let us suppose now that
236$x_\hi > 0$ and that $x_\hi^+ \not = + \infty$ where $x_\hi^+$ is the
237successor of
238$x_\hi$ in the ordered set of floating point numbers.\\
239So we know by the definition of non-subnormal floating point number in double
240precision that there exists
241$m \in \N$ and $e \in \Z$ such that
242$x_\hi = 2^e \cdot m$ with $2^{52} \leq m < 2^{53}$. Anyway, one can check that
243$$x_\hi^+ = \left \lbrace \begin{array}{lll} 2^e \cdot \left(m + 1 \right) & \mbox{ if } & m+1 < 2^{53} \\
244                                             2^{e+1} \cdot 2^{52} & \mbox{ otherwise} & \end{array} \right.$$
245So 2 cases must be treated separately:\\~\\
246{\bf 1st case: $x_\hi^+ = 2^e \cdot \left( m + 1 \right)$} \\
247So we get
248\begin{eqnarray*}
2492^e \cdot \left( m + 1 \right) - 2^e \cdot m & > & 2^{-52} \cdot 2^e \cdot m \\
2501 & > &  2^{-52} \cdot m
251\end{eqnarray*}
252In contrast, $m \geq 2^{52}$, so we obtain the strict inequality $1 > 1$
253which contradicts the hypotheses. \\~\\
254{\bf 2nd case: $x_\hi^+ = 2^{e+1} \cdot 2^{52}$} \\
255In this case, we know that $m=2^{53} - 1$. \\
256We can deduce that
257\begin{eqnarray*}
2582^{e+1} \cdot 2^{52} - 2^e \cdot \left( 2^{53} - 1\right) & > & 2^{-52} \cdot 2^e \cdot \left( 2^{53} - 1 \right) \\
2591 & > &  2 - 2^{-52}
260\end{eqnarray*}
261This last inequality is a direct contradiction with the hypotheses.\qed
262\end{proof}
263\begin{lemma}[Commutativity of the $x^+$ and $x^-$ operators with unary $-$] \label{commut} ~ \\
264Let be $x \in \F$ a positive floating point number.\\
265So,
266$$\left( - x\right)^+ = -\left(x^+\right)$$
267and
268$$\left( - x\right)^- = -\left(x^-\right)$$
269\end{lemma}
270\begin{proof} ~ \\
271Since the set of the floating point numbers is symmetrical around $0$, we get
272$$\left( -x\right)^+ = \pred\left( -x \right) = -\succ\left( x \right) = - \left(x^+\right)$$
273and
274$$\left( -x\right)^- = \succ\left( -x \right) = -\pred\left( x \right) = - \left(x^-\right)$$\qed
275\end{proof}
276\begin{lemma}[$x^+$ and $x^-$ for an integer power of $2$] \label{poweroftwo} ~ \\
277Let be $x \in \F$ a non-subnormal floating point number such that it exists $e \in \Z$ such that
278$$x=\pm2^e \cdot 2^p$$
279where $p \geq 2$ is the format's precision.\\
280So,
281$$x - x^-= \frac{1}{2} \cdot \left( x^+ - x \right)$$
282\end{lemma}
283\begin{proof} ~\\
284If $x > 0$, we get
285$$x - x^- = 2^e \cdot 2^p - 2^{e-1} \cdot \left( 2^{p+1} - 1 \right) = 2^{e-1}$$
286and
287$$x^+ - x = 2^e \cdot \left( 2^p + 1 \right) - 2^e \cdot 2^p = 2^e$$
288If $x$ is negative it suffices to apply lemma \ref{commut}.\qed
289\end{proof}
290\begin{lemma}[$x^+$ and $x^-$ for a float different from an integer power of $2$] \label{notpoweroftwo} ~\\
291Let be $x \in \F$ a non-subnormal floating point number such that it does not exist any $e \in \Z$
292such that $$x=\pm2^e \cdot 2^p$$
293where $p \geq 2$ is the format's precision.\\
294So,
295$$x - x^- = x^+ - x$$
296\end{lemma}
297\begin{proof} ~ \\
298If $x > 0$ we know that there exist $e \in \Z$ and $m \in \N$ such that
299$$x = 2^e \cdot m$$
300with
301$$2^p < m < 2^{p-1}$$
302because $x$ is not exactly an integer power of $2$. \\
303Further, one checks that
304$$x^+ = 2^e \cdot \left( m + 1 \right)$$
305even if $m = 2^{p-1} -1$ and that
306$$x^- = 2^e \cdot \left( m - 1 \right)$$
307because the lower bound given for $m$ is strict. \\
308So one gets
309\begin{eqnarray*}
310x - x^- & = &
3112^e \cdot m - 2^e \cdot \left(m - 1 \right) \\
312& = & 2^e \\
313& = & 2^e \cdot \left( m + 1 \right) - 2^e \cdot m \\
314& = & x^+ - x
315\end{eqnarray*}
316If $x$ is negative it suffices to apply lemma \ref{commut}.\qed
317\end{proof}
318\begin{lemma}[Factorized integer powers of $2$ and the operators $x^+$ and $x^-$] \label{multhalf} ~\\
319Let be $x \in \F$ a non-subnormal floating point number such that $\frac{1}{2} \cdot x$ is still not subnormal.\\
320So,
321$$\left(\frac{1}{2} \cdot x \right)^+ = \frac{1}{2} \cdot x^+$$
322and
323$$\left(\frac{1}{2} \cdot x \right)^- = \frac{1}{2} \cdot x^-$$
324\end{lemma}
325\begin{proof} ~ \\
326Without loss of generality let us suppose that $x$ is positive. Otherwise we easily apply lemma \ref{commut}. \\
327So, if $x$ can be written $x = 2^e \cdot m$ with $m + 1 \leq 2^{p+1}$ where $p$ is the precision then
328$$\left( \frac{1}{2} \cdot x \right)^+ = \left( 2^{e-1} \cdot m \right)^+ = 2^{e-1} \cdot \left(m+1\right) = \frac{1}{2} \cdot x^+$$
329Otherwise,
330$$\left( \frac{1}{2} \cdot x \right)^+ = \left( 2^{e-1} \cdot \left( 2^{p+1} -1 \right) \right)^+
331= 2^{e-1+1} \cdot 2^p = \frac{1}{2} \cdot x^+$$
332One can check that one obtains a completely analogous result for $x^-$.\qed
333\end{proof}
334\begin{lemma}[Factor $3$ of an integer power of $2$ in argument of the $x^+$ operator] \label{succtroisfoispuissdeux} ~ \\
335Let be $x \in \F$ a positive floating point number such that $x$ is not subnormal, $x^+$ and $\left( 3 \cdot x \right)^+$
336are different from $+\infty$, and that $\exists e \in \Z \mbox{ . } x = 2^e \cdot 2^p$ where $p \geq 3$ is the precision
337of the format $\F$.\\
338So the following equation holds
339$$\left( 3 \cdot x \right)^+ + \mUlp\left( x \right) = 3 \cdot x^+$$
340\end{lemma}
341\begin{proof} ~ \\
342We can easily check the following
343\begin{eqnarray*}
344\left( 3 \cdot x \right)^+ + \mUlp\left( x \right) & = & \left( 3 \cdot x \right) + \left( x^+ - x \right) \\
345& = & \left( 3 \cdot 2^e \cdot 2^p \right)^+ + \left( 2^e \cdot 2^p \right)^+ - 2^e \cdot 2^p \\
346& = & \left( \left( 2 + 1 \right) \cdot 2^e \cdot 2^p \right)^+ + 2^e \cdot \left( 2^p + 1 \right) - 2^e \cdot 2^p \\
347& = & \left( 2 \cdot 2^e \cdot 2^p + 2 \cdot \frac{1}{2} \cdot 2^e \cdot 2^p \right)^+ + 2^e \\
348& = & \left( 2^{e+1} \cdot \left( 2^p + 2^{p-1} \right) \right)^+ + 2^e \\
349& = & 2^{e+1} \cdot \left( 2^p + 2^{p-1} + 1 \right) + 2^e \\
350& = & 2^{e+1} \cdot \left( 2^p + 2^{p-1} \right) + 2^{e+1} + 2^e \\
351& = & 2^{e+1} \cdot \left( 2^p + 2^{p-1} \right) + 3 \cdot 2^e \\
352& = & 3 \cdot 2^e \cdot 2^p + 3 \cdot 2^e \\
353& = & 3 \cdot 2^e \cdot \left( 2^p + 1 \right) \\
354& = & 3 \cdot \left( 2^e \cdot 2^p \right)^+ \\
355& = & 3 \cdot x^+
356\end{eqnarray*}
357\qed
358\end{proof}
359\begin{lemma}[Monotony of the $\mUlp$ function] \label{ulpmonoton} ~ \\
360The $\mUlp$ function is monotonic for non-subnormal positive floating point numbers and it is monotonic for non-subnormal
361negative floating point numbers, i.e.
362$$\forall x,y \in \F \mbox{ . } denorm < x \leq y \Rightarrow \mUlp\left( x \right) \leq \mUlp\left( y \right)$$
363$$\lor$$
364$$\forall x,y \in \F \mbox{ . } x \leq y < -denorm \Rightarrow \mUlp\left( x \right) \geq \mUlp\left( y \right)$$
365where $denorm$ is the greatest positive subnormal.
366\end{lemma}
367\begin{proof} ~ \\
368As a matter of fact it suffices to show that the $\mUlp$ function is monotonic for non-subnormal floating point numbers
369and to apply its definition \ref{defulp} for the negative case.\\
370Let us suppose so that we have two floating point numbers $x, y \in \F$ such that $denorm < x < y$.
371Without loss of generality we suppose that $x^+ \not = + \infty$ and that
372$y^+ \not = + \infty$. Otherwise we apply definition \ref{defulp} of the $\mUlp$ function and lemma \ref{multhalf}.\\
373So we get
374$$\mUlp\left( y \right) - \mUlp\left( x \right) = y^+ - y - x^+ + x$$
375It suffices now to show that
376$$y^+ - x^+ - y + x \geq 0$$
377We can suppose that we would have
378\begin{eqnarray*}
379x & = & 2^{e_x} \cdot m_x \\
380y & = & 2^{e_y} \cdot m_y
381\end{eqnarray*}
382with $e_x, e_y \in \Z$, $2^p \leq m_x, m_y < 2^{p+1} - 1$.\\
383Since $y > x$, we clearly see that
384$$\left( e_y, m_y \right) \geq_{\mbox{lex}} \left( e_x, m_x \right)$$ \\
385So four different cases are possible:
386\begin{enumerate}
387\item \begin{eqnarray*}
388x^+ & = & 2^{e_x} \cdot \left( m_x + 1 \right) \\
389y^+ & = & 2^{e_y} \cdot \left( m_y + 1 \right)
390\end{eqnarray*}
391Hence
392\begin{eqnarray*}
393y^+ - x^+ - y + x & = & 2^{e_y} \cdot \left( m_y + 1 \right) - 2^{e_x} \cdot \left( m_x + 1 \right) - 2^{e_y} \cdot m_y + 2^{e_x} \cdot m_x \\
394& = & 2^{e_y} - 2^{e_x} \\
395& \geq & 0
396\end{eqnarray*}
397\item \begin{eqnarray*}
398x^+ & = & 2^{e_x} \cdot \left( m_x + 1 \right) \\
399y^+ & = & 2^{e_y+1} \cdot 2^p
400\end{eqnarray*}
401which yields to
402\begin{eqnarray*}
403y^+ - x^+ - y + x & = & 2^{e_y+1} \cdot 2^p - 2^{e_x} \cdot \left( m_x + 1 \right) - 2^{e_y} \cdot \left( 2^{p+1} - 1 \right) + 2^{e_x} \cdot m_x \\
404& = & 2^{e_y} - 2^{e_x} \\
405& \geq & 0
406\end{eqnarray*}
407\item \begin{eqnarray*}
408x^+ & = & 2^{e_x+1} \cdot 2^p \\
409y^+ & = & 2^{e_y} \cdot \left( m_y  + 1 \right)
410\end{eqnarray*}
411One checks that
412\begin{eqnarray*}
413y^+ - x^+ - y + x & = & 2^{e_y} \cdot \left( m_y + 1 \right) - 2^{e_x+1} \cdot 2^p - 2^{e_y} \cdot m_y + 2^{e_x} \cdot \left( 2^{p+1} - 1 \right) \\
414& = & 2^{e_y} - 2^{e_x} \\
415& \geq & 0
416\end{eqnarray*}
417\item \begin{eqnarray*}
418x^+ & = & 2^{e_x+1} \cdot 2^p \\
419y^+ & = & 2^{e_y+1} \cdot 2^p
420\end{eqnarray*}
421Thus
422\begin{eqnarray*}
423y^+ - x^+ - y + x & = & 2^{e_y+1} \cdot 2^p - 2^{e_x+1} \cdot 2^p - 2^{e_y} \cdot \left( 2^{p+1} - 1 \right) + 2^{e_x} \cdot \left( 2^{p-1} - 1\right) \\
424& = & 2^{e_y} - 2^{e_x} \\
425& \geq & 0
426\end{eqnarray*}
427\end{enumerate}
428This finishes the proof.\qed
429\end{proof}
430\section{A normal form and renormalization procedures}
431Let us now analyse a renormalization algorithm. We will prove its
432correctness be a series of lemmas and a final theorem. \\
433Let be the following procedure:
434\begin{algorithm}[Renormalization] \label{renorm}~\\
435{\bf In: $a_\hi, a_\mi, a_\lo \in \F$} verifying the following preconditions:\\
436{\bf Preconditions: }
437\begin{itemize}
438\item None of the numbers $a_\hi, a_\mi, a_\lo$ is subnormal
439\item $a_\hi$ and $a_\mi$ do not overlap in more than $51$ bits
440\item $a_\mi$ and $a_\lo$ do not overlap in more than $51$ bits
441\end{itemize}
442which means formally:
443\begin{eqnarray*}
444\left \vert a_\mi \right \vert & \leq & 2^{-2} \cdot \left \vert a_\hi \right \vert \\
445\left \vert a_\lo \right \vert & \leq & 2^{-2} \cdot \left \vert a_\mi \right \vert \\
446\left \vert a_\lo \right \vert & \leq & 2^{-4} \cdot \left \vert a_\hi \right \vert
447\end{eqnarray*}
448{\bf Out: $r_\hi, r_\mi, r_\lo \in \F$}
449\begin{eqnarray*}
450\left(t_{1\hi}, t_{1\lo}\right) & \gets & \mAdd\left(a_\mi,a_\lo\right) \\
451\left(r_\hi, t_{2\lo}\right) & \gets & \mAdd\left(a_\hi, t_{1\hi}\right) \\
452\left(r_\mi, r_\lo\right) & \gets & \mAdd\left(t_{2\lo}, t_{1\lo}\right)
453\end{eqnarray*}
454\end{algorithm}
455Consult also \cite{Finot-thesis} on the subject of this algorithm.
456Let us give now some lemmas on the properties of the values returned by
457algorithm \ref{renorm} and on the intermediate ones.
458\begin{lemma}[Exact sum] \label{exact} ~\\
459For each triple-double number $a_\hi + a_\mi + a_\lo$, algorithm \ref{renorm}
460returns a triple-double number $r_\hi + r_\mi + r_\lo$ such that
461$$a_\hi + a_\mi + a_\lo = r_\hi + r_\mi + r_\lo$$
462\end{lemma}
463\begin{proof} ~\\
464This fact is a trivial consequence of the properties of the \Add~ algorithm. \qed
465\end{proof}
466\begin{lemma}[Rounding of the middle component] \label{properties}~\\
467For each triple-double number $a_\hi + a_\mi + a_\lo$, algorithm \ref{renorm}
468returns a triple-double number $r_\hi + r_\mi + r_\lo$ such that
469$$r_\mi = \circ \left( r_\mi + r_\lo \right)$$
470The same way, the intermediate and final value will verify the following properties:
471\begin{eqnarray*}
472t_{1\hi} & = & \circ \left( a_\mi + a_\lo \right) \\
473r_\hi & = & \circ \left( a_\hi + t_{1\hi} \right) \\
474\left \vert t_{1\lo} \right \vert & \leq & 2^{-53} \cdot \left \vert t_{1\hi} \right \vert \\
475\left \vert t_{2\lo} \right \vert & \leq & 2^{-53} \cdot \left \vert r_\hi \right \vert \\
476\end{eqnarray*}
477In particular, $r_\mi$ will not be equal to $0$ if $r_\lo$ is not equal to $0$.
478\end{lemma}
479\begin{proof} ~\\
480This fact is a trivial consequence of the properties of the \Add~ algorithm. \qed
481\end{proof}
482\begin{lemma}[Upper bounds] \label{major}~\\
483For all arguments of algorithm \ref{renorm},
484the intermediate and final values
485$t_{1\hi}$, $t_{1\lo}$, $t_{2\lo}$ and $r_\mi$
486can be bounded upwards as follows:
487\begin{eqnarray*}
488\left \vert t_{1\hi} \right \vert & \leq & 2^{-1} \cdot \left \vert a_\hi \right \vert \\
489\left \vert t_{1\lo} \right \vert & \leq & 2^{-54} \cdot \left \vert a_\hi \right \vert \\
490\left \vert t_{2\lo} \right \vert & \leq & 2^{-52} \cdot \left \vert a_\hi \right \vert \\
491\left \vert t_\mi \right \vert & \leq & 2^{-51} \cdot \left \vert a_\hi \right \vert
492\end{eqnarray*}
493\end{lemma}
494\begin{proof} ~\\
495\begin{enumerate}
496\item {\bf Upper bound for $\left \vert t_{1\hi} \right \vert$:}\\
497We have supposed that
498\begin{eqnarray*}
499\left \vert a_\mi \right \vert & \leq & 2^{-2} \cdot \left \vert a_\hi \right \vert \\
500\left \vert a_\lo \right \vert & \leq & 2^{-4} \cdot \left \vert a_\hi \right \vert
501\end{eqnarray*}
502So we can check that
503\begin{eqnarray*}
504\left \vert t_{1\hi} \right \vert & \leq & \left \vert a_\mi \right \vert + \left \vert a_\lo \right \vert +
5052^{-54} \cdot \left \vert a_\hi \right \vert\\
506& \leq & 2^{-2} \cdot \left \vert a_\hi \right \vert + 2^{-4} \cdot \left \vert a_\hi \right \vert +
5072^{-54} \cdot \left \vert a_\hi \right \vert \\
508& \leq & 2^{-1} \cdot \left \vert a_\hi \right \vert
509\end{eqnarray*}
510\item {\bf Upper bound for $\left \vert t_{1\lo} \right \vert$:}\\
511Using the properties of the \Add~ algorithm we can get to know that
512$$\left \vert t_{1\lo} \right \vert \leq 2^{-53} \cdot \left \vert t_{1\hi} \right \vert$$
513which yields finally to
514$$\left \vert t_{1\lo} \right \vert \leq 2^{-54} \cdot \left \vert a_\hi \right \vert$$
515\item {\bf Upper bound for $\left \vert t_{2\lo} \right \vert$:}
516\begin{eqnarray*}
517\left \vert t_{2\lo} \right \vert & \leq & 2^{-53} \cdot \left \vert r_\hi \right \vert \\
518& \leq & 2^{-53} \cdot \circ \left( \left \vert a_\hi \right \vert + \left \vert t_{1\hi} \right \vert \right) \\
519& \leq & 2^{-53} \cdot \left \vert a_\hi \right \vert + 2^{-53} \cdot \left \vert t_{1\hi} \right \vert + 2^{-106} \cdot \left \vert a_\hi \right \vert +
5202^{-106} \cdot \left \vert t_{1\hi} \right \vert \\
521& \leq & 2^{-53} \cdot \left \vert a_\hi \right \vert + 2^{-54} \cdot \left \vert a_\hi \right \vert + 2^{-106} \cdot \left \vert a_\hi \right \vert +
5222^{-107} \cdot \left \vert a_\hi \right \vert \\
523& \leq & 2^{-52} \cdot \left \vert a_\hi \right \vert
524\end{eqnarray*}
525\item {\bf Upper bound for $\left \vert r_\mi \right \vert$:}
526\begin{eqnarray*}
527\left \vert r_\mi \right \vert & \leq & \left \vert t_{2\lo} \oplus t_{1\lo} \right \vert \\
528& \leq & \left \vert t_{2\lo} \right \vert + \left \vert t_{1\lo} \right \vert + 2^{-53} \cdot \left \vert t_{2\lo} + t_{1\lo} \right \vert \\
529& \leq & 2^{-52} \cdot \left \vert a_\hi \right \vert + 2^{-54} \cdot \left \vert a_\hi \right \vert + 2^{-105} \cdot \left \vert a_\hi \right \vert +
5302^{-107} \cdot \left \vert a_\hi \right \vert \\
531& \leq & 2^{-51} \cdot \left \vert a_\hi \right \vert
532\end{eqnarray*}
533\end{enumerate} ~ \qed
534\end{proof}
535\begin{lemma}[Special case for $r_\hi = 0$] \label{specialcaseinzero}~\\
536For all arguments verifying the preconditions of algorithm \ref{renorm},
537$r_\hi$ will not be equal to $0$ if $r_\mi$ is not equal to $0$. \\
538Formally:
539$$r_\hi = 0 \Rightarrow r_\mi = 0$$
540\end{lemma}
541\begin{proof} ~\\
542Let us suppose that $r_\hi = 0$ and that $r_\mi \not = 0$. So we get
543\begin{eqnarray*}
544\left \vert r_\hi \right \vert & = & \left \vert \circ \left( a_\hi + t_{1\hi} \right) \right \vert \\
545& \geq & \left \vert \circ \left( 2^{-1} \cdot a_\hi \right) \right \vert \\
546& = & 2^{-1} \left \vert a_\hi \right \vert
547\end{eqnarray*}
548because we have already shown that $$\left \vert t_{1\hi} \right \vert \leq 2^{-1} \cdot \left \vert a_\hi \right \vert$$
549So for $r_\hi$ being equal to $0$, $a_\hi$ must be equal to $0$.\\
550In contrast, this yields to $t_{1\hi} = 0$ because $$r_\hi = \circ \left( 0 + t_{1\hi} \right) = t_{1\hi}$$
551This implies that $t_{1\lo} = 0$ because of the properties of the \Add~
552procedure.
553The same way, we get $t_{2\lo} = 0$.\\
554We can deduce from this that
555$$0 \not = r_\mi = \circ \left( 0 + 0 \right) = 0$$ which is a contradiction.\qed
556\end{proof}
557\begin{lemma}[Lower bound for $\left \vert r_\hi \right \vert$] \label{minor}~\\
558For all arguments verifying the preconditions of algorithm \ref{renorm},
559the final result
560$r_\hi$
561can be bounded in magnitude as follows:
562$$\left \vert r_\hi \right \vert \geq 2^{-1} \cdot \left \vert a_\hi \right \vert$$
563\end{lemma}
564\begin{proof} ~\\
565We have that
566$$r_\hi = a_\hi \oplus t_{1\hi}$$
567Clearly, if $a_\hi$ and $t_{1\hi}$ have the same sign, we get
568$$\left \vert r_\hi \right \vert \geq \left \vert a_\hi \right \vert \geq 2^{-1} \cdot \left \vert a_\hi \right \vert$$
569Otherwise - $a_\hi$ and $t_{1\hi}$ are now of the opposed sign - we have
570already seen that
571$$\left \vert t_{1\hi} \right \vert \leq 2^{-1} \cdot \left \vert a_\hi \right \vert$$
572So, in this case, too, we get
573$$\left \vert r_\hi \right \vert \geq 2^{-1} \cdot \left \vert a_\hi \right \vert$$ \qed
574\end{proof}
575\begin{corollary}[Additional property on the \Add~procedure] \label{addsupp} ~\\
576Let be $r_\hi$ and $r_\lo$ two double precision floating point numbers returned
577by the \Add~ procedure. \\
578So
579$$\left \vert r_\lo \right \vert \leq \frac{1}{2} \cdot \mUlp\left( r_\hi \right)$$
580\end{corollary}
581\begin{proof} ~\\
582By the definition \ref{adddef} of the \Add~ procedure, we have
583$r_\hi + r_\lo = x + y$ and $r_\hi = \circ \left( x + y \right)$ and $r_\lo = x+y -r_\lo$.
584Thus the number $r_\lo = \left( x + y \right) - \circ \left( x + y \right) =
585\left( x + y \right) - \left( x \oplus y \right)$ is the absolute error of correctly
586rounded IEEE 754 addition. It is bounded by $\frac{1}{2} \cdot \mUlp\left( r_\hi \right)$ which
587gives us the desired result.\qed
588\end{proof}
589\begin{theorem}[Correctness of the renormalization algorithm \ref{renorm}] ~\\
590For all arguments verifying the preconditions of procedure \ref{renorm},
591the values returned
592$r_\hi$, $r_\mi$ and $r_\lo$ will not overlap
593unless they are all equal to $0$ and their sum will be exactly the sum of the
594values in argument $a_\hi$, $a_\mi$ and $a_\lo$.
595\end{theorem}
596\begin{proof} ~ \\
597The fact that the sum of the values returned is exactly equal to the sum of
598the values in argument has already been proven by lemma \ref{exact}.\\
599Without loss of generality, we will now suppose that neither $r_\hi$ nor
600$r_\mi$ will be $0$ in which case all values returned would be equal to $0$
601as we have shown it by lemmas \ref{specialcaseinzero} and \ref{properties}.\\
602Using lemma \ref{properties}, we know already that $r_\mi$ and $r_\lo$ do not
603overlap.
604Let us show now that $r_\hi$ and $r_\mi$ do not overlap
605by proving that the following inequality is true
606$$\left \vert r_\mi \right \vert \leq \frac{3}{4} \cdot \mUlp\left( r_\hi
607\right) < \mUlp\left( r_\hi \right)$$
608There are two different cases to be treated. \\ ~ \\
609{\bf 1st case: $t_{2\lo} = 0$} \\
610We know that
611$$r_\mi = \circ \left( t_{2\lo} + t_{1\lo} \right) = \circ \left( 0 + t_{1\lo} \right) = t_{1\lo}$$
612When showing lemma \ref{major}, we have already proven that
613$$\left \vert t_{1\lo} \right \vert \leq 2^{-54} \cdot \left \vert a_\hi \right \vert$$
614Using lemma \ref{minor}, we therefore know that
615$$\left \vert r_\mi \right \vert \leq 2^{-53} \cdot \left \vert r_\hi \right \vert$$
616which is the result we wanted to prove.\\ ~ \\
617{\bf 2nd case: $t_{2\lo} \not = 0$} \\
618Still using lemma \ref{major}, we have shown that
619$$\left \vert t_{1\hi} \right \vert \leq 2^{-1} \cdot \left \vert a_\hi \right \vert$$
620In consequence, when the IEEE 754 \cite{IEEE754} addition $r_\hi = a_\hi \oplus t_{1\hi}$ is
621ported out, the rounding will be done at a bit of weight heigher than one
622$\mUlp\left(t_{1\hi} \right)$ because $t_{2\lo}$ is strictly greater than $0$
623and because $a_\hi$ and $t_{1\hi}$
624do not completely overlap. Therefore we can check that
625$$\left \vert t_{2\lo} \right \vert \geq \mUlp\left( t_{1\hi} \right)$$
626With the result of lemma \ref{major} we already mentioned, we can deduce that
627$$\left \vert t_{2\lo} \right \vert \leq \frac{1}{2} \cdot \mUlp\left( t_{1\hi} \right) \leq \frac{1}{2} \cdot \left \vert t_{2\lo} \right \vert$$
628So one can verify the following upper bound using among others lemma \ref{addsupp}:
629\begin{eqnarray*}
630\left \vert r_\mi \right \vert & = & \left \vert \circ \left(t_{2\lo} + t_{1\lo} \right) \right \vert \\
631& \leq & \circ \left( \frac{3}{2} \cdot \left \vert t_{2\lo} \right \vert \right) \\
632& \leq & \circ \left( \frac{3}{4} \cdot \mUlp \left( r_\hi \right) \right) \\
633& = & \frac{3}{4} \cdot \mUlp \left( r_\hi \right)
634\end{eqnarray*}
635One remarks that the last simplification is correct here because $\mUlp$ is
636always equal to an integer power of $2$ and because the precision of a double
637is greater than $4$ bits.\qed
638\end{proof}
639\section{Operators on double-double numbers}
640Since we dispose now of a renormalization procedure which is effective and
641proven, we can now consider the different addition and multiplication
642operators we need. They will surely work finally on expansions of size $3$,
643but the double-double format \cite{Dek71} must be analysed, too, because it is at the base
644of the triple-double format. We already mentioned that on definition and
645analysis of this operators, we need not care such a lot of the overlap in the
646components of a triple-double number any more: as long as the overlap does
647not make us loose a too much of the final accuracy because several bits of the
648\ouvguill significand\fermguill~ are represented twice, overlap is not of an
649issue for intermediate values. At the end of triple-double computations, it
650will be sufficient to apply once the renormalization procedure. In order to
651measure the consequences of an overlap in the operands on final accuracy and
652in order to be able to follow the increase of the overlap during computations
653in triple-double, we will indicate for each operator which produces a triple
654double result or which takes a triple-double operand not only a bound for
655relative and absolute rounding errors but also a bound for the maximal overlap
656of the values returned. All this bounds will be parameterised by a variable
657representing the maximal overlap of the triple-double arguments.
658\subsection{The addition operator \AddDD}
659Let us analyse first the following addition procedure:
660\begin{algorithm}[\AddDD] \label{addDDref} ~ \\
661{\bf In:} two double-double numbers, $a_\hi + a_\lo$ and $b_\hi + b_\lo$ \\
662{\bf Out:} a double-double number $r_\hi + r_\lo$ \\
663{\bf Preconditions on the arguments:} $$\left \vert a_\lo \right \vert \leq 2^{-53} \cdot \left \vert a_\hi \right \vert$$
664                                $$\left \vert b_\lo \right \vert \leq 2^{-53} \cdot \left \vert b_\hi \right \vert$$
665{\bf Algorithm:} \\
666\begin{center}
667\begin{minipage}[b]{50mm}
668$t_1 \gets a_\hi \oplus b_\hi$ \\
669{\bf if} $\left \vert a_\hi \right \vert \geq \left \vert b_\hi \right \vert$ {\bf then}
670\begin{center}
671\begin{minipage}[b]{40mm}
672$t_2 \gets a_\hi \ominus t_1$ \\
673$t_3 \gets t_2 \oplus b_\hi$ \\
674$t_4 \gets t_3 \oplus b_\lo$ \\
675$t_5 \gets t_4 \oplus a_\lo$
676\end{minipage}
677\end{center}
678{\bf else}
679\begin{center}
680\begin{minipage}[b]{40mm}
681$t_2 \gets b_\hi \ominus t_1$ \\
682$t_3 \gets t_2 \oplus a_\hi$ \\
683$t_4 \gets t_3 \oplus a_\lo$ \\
684$t_5 \gets t_4 \oplus b_\lo$
685\end{minipage}
686\end{center}
687{\bf end if} \\
688$\left( r_\hi, r_\lo \right) \gets \mAdd\left( t_1, t_5 \right)$
689\end{minipage}
690\end{center}
691\end{algorithm}
692Compare \cite{crlibmweb} concerning algorithm \ref{addDDref}.
693\begin{theorem}[Relative error of algorithm \ref{addDDref} \AddDD~ without
694    occurring of cancellation\label{theoAddDDref}] ~ \\
695Let be $a_\hi + a_\lo$ and $b_\hi + b_\lo$ the double-double arguments of algorithm \ref{addDDref} \AddDD.\\
696If $a_\hi$ and $b_\hi$ have the same sign, so we know that
697$$r_\hi + r_\lo = \left(\left(a_\hi + a_\lo \right) + \left( b_\hi + b_\lo \right)\right) \cdot \left(1 + \epsilon\right)$$
698where $\epsilon$ is bounded as follows:
699$$\left \vert \epsilon \right \vert \leq 2^{-103,5}$$
700\end{theorem}
701\begin{proof} \label{AddDDpreuve} ~ \\
702Since the algorithm \AddDD~ ends by a call to the \Add~ procedure, it suffices
703to show that
704$$t_1 + t_5 = \left(\left(a_\hi + a_\lo \right) + \left( b_\hi + b_\lo \right)\right) \cdot \left(1 + \epsilon\right)$$
705Further, since the two branches of the algorithm are symmetrical, we can
706suppose that $\left \vert a_\hi \right \vert \geq \left \vert b_\hi \right \vert$
707and consider only one branch without loss of generality.
708Finally, we remark that the following lines of the \AddDD~ procedure
709constitute a non-conditional \Add~ with arguments $a_\hi$ and
710$b_\hi$ and the result $t_1 + t_3$:
711\begin{center}
712\begin{minipage}[b]{50mm}
713$t_1 = a_\hi \oplus b_\hi$ \\
714$t_2 = a_\hi \ominus t_1$ \\
715$t_3 = t_2 \oplus b_\hi$
716\end{minipage}
717\end{center}
718Thus, we get
719\begin{eqnarray*}
720t_5 & = & t_4 \oplus a_\lo \\
721& = & \left( t_4 + a_\lo \right) \cdot \left( 1 + \epsilon_1 \right) \\
722& = & \left( \left( t_3 + bl \right) \cdot \left( 1 + \epsilon_2 \right) + a_\lo \right) \cdot \left( 1 + \epsilon_1 \right) \\
723& = & t_3 + a_\lo + b_\lo + \delta
724\end{eqnarray*}
725with
726$$\delta = t_3\cdot\epsilon_2 + b_\lo\cdot\epsilon_2 + t_3\cdot\epsilon_1 + b_\lo\cdot\epsilon_1 + t_3\cdot\epsilon_2\cdot\epsilon_2
727+ b_\lo\cdot\epsilon_2\cdot\epsilon_2 + a_\lo\cdot\epsilon_1$$
728For giving an upper bound for $\left \vert \delta \right \vert$, let us first
729give an upper bound for $\left \vert t_3 \right \vert$, $\left \vert a_\lo \right \vert$ and
730$b_\lo$ as function of $\left \vert a_\hi + b_\hi \right \vert$ using the
731following bounds that we know already:
732\begin{eqnarray*}
733\left \vert a_\lo \right \vert & \leq & 2^{-53} \cdot \left \vert a_\hi \right \vert \\
734\left \vert b_\lo \right \vert & \leq & 2^{-53} \cdot \left \vert b_\hi \right \vert \\
735\left \vert t_3 \right \vert & \leq & 2^{-53} \cdot \left \vert t_1 \right \vert
736\end{eqnarray*}
737We get therefore
738\begin{eqnarray*}
739\left \vert t_3 \right \vert & \leq & 2^{-53} \cdot \left \vert t_1 \right \vert \\
740& = & 2^{-53} \cdot \left \vert a_\hi \oplus b_\hi \right \vert \\
741& \leq & 2^{-53} \cdot \left \vert a_\hi + b_\hi \right \vert + 2^{-106} \cdot \left \vert a_\hi + b_\lo \right \vert
742\end{eqnarray*}
743and than
744\begin{eqnarray*}
745\left \vert a_\lo \right \vert & \leq & 2^{-53} \cdot \left \vert a_\hi \right \vert \\
746& \leq & 2^{-53} \cdot \left \vert a_\hi + b_\hi \right \vert
747\end{eqnarray*}
748The last bound is verified because we suppose that $a_\hi$ and $b_\hi$ have the
749same sign. \\
750Finally, since $\left \vert a_\hi \right \vert \geq \left \vert b_\hi \right \vert$,
751\begin{eqnarray*}
752\left \vert b_\lo \right \vert & \leq & 2^{-53} \cdot \left \vert b_\hi \right \vert \\
753& \leq & 2^{-53} \cdot \left \vert a_\hi \right \vert \\
754& \leq & 2^{-53} \cdot \left \vert a_\hi + b_\hi \right \vert
755\end{eqnarray*}
756Thus we get for $\left \vert \delta \right \vert$:
757\begin{eqnarray*}
758\left \vert \delta \right \vert & \leq & \left \vert a_\hi + b_\hi \right \vert \cdot \left(
759                                         2^{-106} + 2^{-159} + 2^{-106} + 2^{-106} + 2^{-159} +
760                                         2^{-106} + 2^{-159} + 2^{-212} + 2^{-212} + 2^{-106} \right) \\
761& \leq & \left \vert a_\hi + b_\hi \right \vert \cdot \left( 2^{-104} + 2^{-106} + 2^{-158} + 2^{-159} + 2^{-211} \right)
762\end{eqnarray*}
763Let us now give a lower bound for $\left \vert a_\hi + a_\lo + b_\hi + b_\lo
764\right \vert$ as a function of $\left \vert a_\hi + b_\hi \right \vert$
765in order to be able to give a relative error bound for the procedure
766\AddDD. We have that
767\begin{eqnarray*}
768\left \vert a_\lo + b_\lo \right \vert & \leq & \left \vert a_\lo \right \vert + \left \vert b_\lo \right \vert \\
769& \leq & 2^{-53} \cdot \left \vert a_\hi \right \vert + 2^{-53} \cdot \left \vert b_\hi \right \vert \\
770& \leq & 2^{-52} \cdot \left \vert a_\hi \right \vert \\
771& \leq & 2^{-52} \cdot \left \vert a_\hi + b_\hi \right \vert
772\end{eqnarray*}
773So we can check that
774$$\left \vert a_\hi + a_\lo + b_\hi + b_\lo \right \vert \geq \left( 1 - 2^{-52} \right) \cdot \left \vert a_\hi + b_\hi \right \vert$$
775Concerning $\left \vert \delta \right \vert$, this yields to
776$$\left \vert \delta \right \vert \leq
777\left \vert a_\hi + a_\lo + b_\hi + b_\lo \right \vert \cdot \frac{1}{1-2^{-52}} \cdot
778\left( 2^{-104} + 2^{-106} + 2^{-158} + 2^{-159} + 2^{-211} \right)$$
779One easily checks that
780$$ \frac{1}{1-2^{-52}} \cdot \left( 2^{-104} + 2^{-106} + 2^{-158} + 2^{-159} + 2^{-211} \right) \leq 2^{-103,5}$$
781from which one trivially deduces the affirmation.\qed
782\end{proof}
783\begin{theorem}[Relative error of algorithm \ref{addDDref} \AddDD~ with a
784    bounded cancellation\label{theoAddDDrefborn}] ~ \\
785Let be $a_\hi + a_\lo$ and $b_\hi + b_\lo$ the double-double arguments of \ref{addDDref} \AddDD.\\
786If $a_\hi$ and $b_\hi$ are of different sign and if one can check that
787$$\left \vert b_\hi \right \vert \leq 2^{-\mu} \cdot \left \vert a_\hi \right
788\vert$$ for $\mu \geq 1$ \\
789so the returned result will verify
790$$r_\hi + r_\lo = \left(\left(a_\hi + a_\lo \right) + \left( b_\hi + b_\lo \right)\right) \cdot \left(1 + \epsilon\right)$$
791where $\epsilon$ is bounded as follows:
792$$\left \vert \epsilon \right \vert \leq 2^{-103}\cdot \frac{1-2^{-\mu - 1}}{1-2^{-\mu}-2^{-52}} \leq 2^{-102}$$
793\end{theorem}
794\begin{proof} ~ \\
795Let us reuse the results obtained at the proof \ref{AddDDpreuve} and let us
796start by giving an upper bound for $\left \vert b_\lo \right \vert$
797as a function of $\left \vert a_\hi  \right \vert$:
798$$\left \vert b_\lo \right \vert \leq 2^{-53} \cdot \left \vert b_\hi \right \vert \leq 2^{-53-\mu} \cdot \left \vert a_\hi \right \vert$$
799Let us now continue with a lower bound for $\left \vert a_\hi + b_\hi \right
800\vert$ still as a function of $\left \vert a_\hi \right \vert$:
801$$\left \vert a_\hi + b_\hi \right \vert \geq \left \vert a_\hi \right \vert \cdot \left( 1 - 2^{-\mu} \right)$$
802We get in consequence
803$$\left \vert a_\lo \right \vert \leq \frac{2^{-53}}{1-2^{-\mu}} \cdot \left \vert a_\hi + b_\hi \right \vert$$
804and
805$$\left \vert b_\lo \right \vert \leq \frac{2^{-53-\mu}}{1-2^{-\mu}} \cdot \left \vert a_\hi + b_\hi \right \vert$$
806Thus we can check that
807$$\left \vert \delta \right \vert \leq \left \vert a_\hi + b_\hi \right \vert \cdot 2^{-103} \cdot \frac{1-2^{-\mu-1}}{1-2^{-\mu}}$$
808Once again, we must give a lower bound for $\left \vert a_\hi + a_\lo + b_\hi
809  + b_\lo \right \vert$
810with regard to $\left \vert a_\hi + b_\hi \right \vert$:
811We know that
812\begin{eqnarray*}
813\left \vert a_\lo + b_\lo \right \vert & \leq & \left \vert a_\lo \right \vert + \left \vert b_\lo \right \vert \\
814& \leq & 2^{-52} \cdot \left \vert a_\hi \right \vert \\
815& \leq & \frac{2^{-52}}{1-2^{-\mu}} \cdot \left \vert a_\hi + b_\hi \right \vert
816\end{eqnarray*}
817So
818$$\left \vert a_\hi + a_\lo + b_\hi + b_\lo \right \vert \geq \left \vert a_\hi + b_\hi \right \vert \cdot \frac{1-2^{-\mu}-2^{-52}}{1-2^{-\mu}}$$
819Thus we get for $\left \vert \delta \right \vert$
820\begin{eqnarray*}
821\left \vert \delta \right \vert & \leq & \left \vert a_\hi + a_\lo + b_\hi + b_\lo \right \vert \cdot \frac{1-2^{-\mu}}{1-2^{-\mu}-2^{-52}} \cdot
8222^{-103} \cdot \frac{1-2^{-\mu-1}}{1-2^{-\mu}} \\
823& = & \left \vert a_\hi + a_\lo + b_\hi + b_\lo \right \vert \cdot 2^{-103} \cdot \frac{1-2^{-\mu-1}}{1-2^{-\mu}-2^{-52}}
824\end{eqnarray*}
825So finally the following inequality is verified for the relative error $\epsilon$:
826$$\left \vert \epsilon \right \vert \leq 2^{-103} \cdot \frac{1-2^{-\mu-1}}{1-2^{-\mu}-2^{-52}}$$
827We can still give a less exact upper bound for this term by one that does not
828depend on $\mu$ because $\mu \geq 1$:
829$$\frac{1-2^{-\mu-1}}{1-2^{-\mu}-2^{-52}}\leq\frac{\frac{3}{4}}{\frac{1}{2}-2^{-52}}\leq 2$$
830so
831$$\left \vert \epsilon \right \vert \leq 2^{-102}$$\qed
832\end{proof}
833\begin{theorem}[Absolute error of algorithm \ref{addDDref} \AddDD~
834    (general case)\label{addDDerrabs}] ~ \\
835Let be $a_\hi + a_\lo$ and $b_\hi + b_\lo$ the double-double arguments of algorithm \ref{addDDref} \AddDD.\\
836The result $r_\hi + r_\lo$ returned by the algorithm verifies
837$$r_\hi + r_\lo = \left(a_\hi + a_\lo \right) + \left( b_\hi + b_\lo \right) + \delta$$
838where $\delta$ is bounded as follows:
839$$\left \vert \delta \right \vert \leq \max\left( 2^{-53} \cdot \left \vert a_\lo + b_\lo \right \vert,
840                                                  2^{-102} \cdot \left \vert a_\hi + a_\lo + b_\hi + b_\lo \right \vert \right)$$
841\end{theorem}
842\begin{proof} ~ \\
843Without loss of generality, we can now suppose that
844$$\frac{1}{2} \cdot \left \vert a_\hi \right \vert \leq \left \vert b_\hi \right \vert \leq \left \vert a_\hi \right \vert$$
845and that $a_\hi$ and $b_\hi$ have different signs
846because for all other cases, the properties we have to show are a direct
847consequence of theorems \ref{theoAddDDref} and \ref{theoAddDDrefborn}.\\
848So we have
849$$\frac{1}{2} \cdot \left \vert a_\hi \right \vert \leq \left \vert b_\hi \right \vert \leq 2 \cdot \left \vert a_\hi \right \vert$$
850and
851$$\frac{1}{2} \cdot \left \vert b_\hi \right \vert \leq \left \vert a_\hi \right \vert \leq 2 \cdot \left \vert b_\hi \right \vert$$
852So the floating point operation
853$$t_1 = a_\hi \oplus b_\hi$$
854is exact by Sterbenz' lemma \cite{Ste74}.
855In consequence, $t_3$ will be equal to $0$ because, as we have already
856mentioned, the operations computing $t_1$ and $t_3$ out of $a_\hi$ and $b_\hi$
857constitute a \Add~ whose properties assure that
858$$t_3 = a_\hi + b_\hi - t_1$$
859We can deduce that
860$$t_4 = t_3 \oplus b_\lo = b_\lo$$
861and can finally check that
862$$t_5 = t_4 \oplus a_\lo = \left( t_4 + a_\lo \right) \cdot \left( 1 + \epsilon^* \right)$$
863with
864$$\left \vert \epsilon^* \right \vert \leq 2^{-53}$$
865So we get
866$$r_\hi + r_\lo = t_1 + t_5 = \left( a_\hi + a_\lo + b_\hi + b_\lo \right) + \delta$$
867with
868$$\left \vert \delta \right \vert \leq 2^{-53} \cdot \left \vert a_\lo + b_\lo \right \vert$$
869which yields to the bound to be proven
870$$\left \vert \delta \right \vert = \max\left( 2^{-53} \cdot \left \vert a_\lo + b_\lo \right \vert,
871                                               2^{-102} \cdot \left \vert a_\hi + a_\lo + b_\hi + b_\lo \right \vert \right)$$ \qed
872\end{proof}
873\begin{theorem}[Output overlap of algorithm \ref{addDDref} \AddDD] ~ \\
874Let be $a_\hi + a_\lo$ and $b_\hi + b_\lo$ the double-double arguments of algorithm \ref{addDDref} \AddDD.\\
875So the values $r_\hi$ and $r_\lo$ returned by the algorithm will not overlap
876at all and will verify
877$$\left \vert r_\lo \right \vert \leq 2^{-53} \cdot \left \vert r_\hi \right \vert$$
878\end{theorem}
879\begin{proof} ~\\
880The proof of the affirmed property is trivial because the procedure \AddDD~
881ends by a call to sequence \Add~ which assures it.\qed
882\end{proof}
883\subsection{The multiplication operator \MulDD}
884Let us now consider the multiplication operator \MulDD:
885\begin{algorithm}[\MulDD] \label{mulDDref} ~ \\
886{\bf In:} two double-double numbers, $a_\hi + a_\lo$ and $b_\hi + b_\lo$ \\
887{\bf Out:} a double-double number $r_\hi + r_\lo$ \\
888{\bf Preconditions on the arguments:} $$\left \vert a_\lo \right \vert \leq 2^{-53} \cdot \left \vert a_\hi \right \vert$$
889                            $$\left \vert b_\lo \right \vert \leq 2^{-53} \cdot \left \vert b_\hi \right \vert$$
890{\bf Algorithm:} \\
891\begin{center}
892\begin{minipage}[b]{50mm}
893$\left( t_1, t_2 \right) \gets \mMul\left( a_\hi, b_\hi \right)$ \\
894$t_3 \gets a_\hi \otimes b_\lo$ \\
895$t_4 \gets a_\lo \otimes b_\hi$ \\
896$t_5 \gets t_3 \oplus t_4$ \\
897$t_6 \gets t_2 \oplus t_5$ \\
898$\left(r_\hi, r_\lo \right) \gets \mAdd\left( t_1, t_6 \right)$\\
899\end{minipage}
900\end{center}
901\end{algorithm}
902Compare also to \cite{crlibmweb} concerning algorithm \ref{mulDDref}.
903\begin{theorem}[Relative error of algorithm \ref{mulDDref} \MulDD] ~ \\
904Let be $a_\hi + a_\lo$ and $b_\hi + b_\lo$ the double-double arguments of algorithm \ref{mulDDref} \MulDD.\\
905So the values returned $r_\hi$ and $r_\lo$ verify
906$$r_\hi + r_\lo = \left(\left(a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\lo \right)\right) \cdot \left(1 + \epsilon\right)$$
907where $\epsilon$ is bounded as follows:
908$$\left \vert \epsilon \right \vert \leq 2^{-102}$$
909Further $r_\hi$ and $r_\lo$ will not overlap at all and verify
910$$\left \vert r_\lo \right \vert \leq 2^{-53} \cdot \left \vert r_\hi \right \vert$$
911\end{theorem}
912\begin{proof} ~ \\
913Since algorithm \ref{mulDDref} ends by a call to the \Add~ procedure,
914the properties of the latter yield to the fact that $r_\hi$ and $r_\lo$
915do not overlap at all and that $\left \vert r_\lo \right \vert \leq 2^{-53} \cdot \left \vert r_\hi \right \vert$.\\
916In order to give upper bounds for the relative and absolute error of the
917algorithm, let us express $t_6$ as a function of $t_2$, $a_\hi$, $a_\lo$,
918$b_\hi$ and $b_\lo$ joined by the error term $\delta$.\\
919We get
920\begin{eqnarray*}
921t_6 & = & t_2 \oplus \left( a_\hi \otimes b_\lo \oplus a_\lo \otimes b_\hi \right) \\
922& = & \left( t_2 + \left(a_\hi \cdot b_\lo \cdot \left( 1 + \epsilon_1 \right) + a_\lo \cdot b_\hi \cdot \left( 1 + \epsilon_2 \right) \right) \cdot
923\left(1 + \epsilon_3 \right) \right)\cdot \left( 1 + \epsilon_4 \right)
924\end{eqnarray*}
925where $\left \vert \epsilon_i \right \vert \leq 2^{-53}$, $i=1,2,3,4$.\\
926Simplifying this expression, we van verify that
927$$t_6 = t_2 + a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + \delta$$
928with
929\begin{eqnarray*}
930\left \vert \delta \right \vert & \leq & \left \vert a_\lo \cdot b_\lo + a_\hi \cdot b_\lo \cdot \epsilon_1 + a_\lo \cdot b_\hi \cdot \epsilon_2 +
931a_\hi \cdot b_\lo \cdot \epsilon_3 + a_\hi \cdot b_\lo \cdot \epsilon_1 \cdot \epsilon_3 + a_\lo \cdot b_\hi \cdot \epsilon_3 +
932a_\lo \cdot b_\hi \cdot \epsilon_1 \cdot \epsilon_3 \right.\\
933& & \left. + a_\hi \cdot b_\lo \cdot \epsilon_4 + a_\lo \cdot b_\hi \cdot \epsilon_4 +
934a_\hi \cdot b_\lo \cdot \epsilon_1 \cdot \epsilon_4 + a_\lo \cdot b_\hi \cdot \epsilon_2 \cdot \epsilon_4 +
935a_\hi \cdot b_\lo \cdot \epsilon_3 \cdot \epsilon_4 \right. \\
936& & \left. + a_\hi \cdot b_\lo \cdot \epsilon_1 \cdot \epsilon_3 \cdot \epsilon_4 + a_\lo \cdot b_\hi \cdot \epsilon_3 \cdot \epsilon_4 + a_\lo \cdot b_\hi \cdot \epsilon_2 \cdot \epsilon_3 \cdot \epsilon_4 \right \vert \\
937& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 7 \cdot 2^{-106} + 6 \cdot 2^{-159} + 2^{-211} \right) \\
938& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot 2^{-103}
939\end{eqnarray*}
940For checking the given bound, we have supposed the following inequalities:
941$$\left \vert a_\lo \right \vert \leq 2^{-53} \cdot \left \vert a_\hi \right \vert$$
942and
943$$\left \vert a_\lo \right \vert \leq 2^{-53} \cdot \left \vert a_\hi \right \vert$$
944Let us now give a lower bound for
945$\left \vert \left( a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\lo
946  \right)\right \vert$ as a function of
947$\left \vert a_\hi \cdot b_\hi \right \vert$. For doing so, we give an upper
948bound for
949$\left \vert a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\lo \right \vert$. \\
950We verify since:
951\begin{eqnarray*}
952\left \vert a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\lo \right \vert & \leq &
953\left \vert a_\hi \cdot b_\lo \right \vert + \left \vert a_\lo \cdot b_\hi \right \vert + \left \vert a_\lo \cdot b_\lo \right \vert \\
954& \leq & 2^{-53} \cdot \left \vert a_\hi \cdot b_\hi \right \vert + 2^{-53} \cdot \left \vert a_\hi \cdot b_\hi \right \vert +
9552^{-106} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \\
956& \leq & 2^{-51} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
957\end{eqnarray*}
958This yields to
959\begin{eqnarray*}
960\left \vert \left( a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\lo \right) \right \vert & \geq &
961\left \vert a_\hi \cdot b_\hi \right \vert \cdot \left(1 - 2^{-51} \right) \\
962& \geq & \frac{1}{2} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
963\end{eqnarray*}
964from which we deduce that
965$$\left \vert \delta \right \vert \leq 2^{-102} \cdot \left \vert \left( a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\lo \right) \right \vert$$
966which gives us as an bound for the relative error
967$$r_\hi + r_\lo = \left( a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\lo \right) \cdot \left(1 + \epsilon \right)$$
968with
969$\left \vert \epsilon \right \vert \leq 2^{-102}$. \qed
970\end{proof}
971\section{Addition operators for triple-double numbers}
972\subsection{The addition operator \AddTT}
973We are going to consider now the addition operator \AddTT. We will only
974analyse a simplified case where the arguments' values verify some bounds
975statically known.
976\begin{algorithm}[\AddTT] \label{addTTref} ~ \\
977{\bf In:} two triple-double numbers, $a_\hi + a_\mi + a_\lo$ and $b_\hi + b_\mi + b_\lo$ \\
978{\bf Out:} a triple-double number $r_\hi + r_\mi + r_\lo$ \\
979{\bf Preconditions on the arguments:}
980\begin{eqnarray*}
981\left \vert b_\hi \right \vert & \leq & \frac{3}{4} \cdot \left \vert a_\hi \right \vert \\
982\left \vert a_\mi \right \vert & \leq & 2^{-\alpha_o} \cdot \left \vert a_\hi \right \vert \\
983\left \vert a_\lo \right \vert & \leq & 2^{-\alpha_u} \cdot \left \vert a_\mi \right \vert \\
984\left \vert b_\mi \right \vert & \leq & 2^{-\beta_o} \cdot \left \vert b_\hi \right \vert \\
985\left \vert b_\lo \right \vert & \leq & 2^{-\beta_u} \cdot \left \vert b_\mi \right \vert \\
986\alpha_o & \geq & 4 \\
987\alpha_u & \geq & 1 \\
988\beta_o & \geq & 4 \\
989\beta_u & \geq & 1 \\
990\end{eqnarray*}
991{\bf Algorithm:} \\
992\begin{center}
993\begin{minipage}[b]{50mm}
994$\left(r_\hi, t_1 \right) \gets \mAdd\left( a_\hi, b_\hi \right)$ \\
995$\left(t_2, t_3 \right) \gets \mAdd\left( a_\mi, b_\mi \right)$ \\
996$\left(t_7, t_4 \right) \gets \mAdd\left( t_1, t_2 \right)$ \\
997$t_6 \gets a_\lo \oplus b_\lo$ \\
998$t_5 \gets t_3 \oplus t_4$ \\
999$t_8 \gets t_5 \oplus t_6$ \\
1000$\left( r_\mi, r_\lo \right) \gets \mAdd\left( t_7, t_8 \right)$
1001\end{minipage}
1002\end{center}
1003\end{algorithm}
1004\begin{theorem}[Relative error of algorithm \ref{addTTref} \AddTT\label{theoAddTT}] ~ \\
1005Let be $a_\hi + a_\mi + a_\lo$ and $b_\hi + b_\mi + b_\lo$ the triple-double
1006arguments of algorithm \ref{addTTref} \AddTT~ verifying the given
1007preconditions.\\
1008So the following egality will hold for the returned values $r_\hi$, $r_\mi$ and $r_\lo$
1009$$r_\hi + r_\mi + r_\lo = \left(\left(a_\hi + a_\mi + a_\lo \right) + \left( b_\hi + b_\mi + b_\lo \right)\right) \cdot \left(1 + \epsilon\right)$$
1010where $\epsilon$ is bounded by:
1011$$\left \vert \epsilon \right \vert \leq 2^{-\min\left(\alpha_o + \alpha_u,\beta_o + \beta_u\right) - 47} +
10122^{-\min\left( \alpha_o, \beta_o\right) - 98}$$
1013The returned values $r_\mi$ and $r_\lo$ will not overlap at all and the
1014overlap of $r_\hi$ and $r_\mi$ will be bounded by the following expression:
1015$$\left \vert r_\mi \right \vert \leq 2^{-\min\left( \alpha_o, \beta_o \right) + 5} \cdot \left \vert r_\hi \right \vert$$
1016\end{theorem}
1017\begin{proof} ~ \\
1018The procedure \ref{addTTref} ends by a call to the \Add~ sequence. One can
1019trivially deduce that $r_\mi$ and $r_\lo$ do not overlap at all and verify
1020$$\left \vert r_\lo \right \vert \leq 2^{-53} \cdot \left \vert r_\mi \right \vert$$
1021Further, it suffices that the bounds given at theorem \ref{theoAddTT} hold for
1022$t_7$ and $t_8$ because
1023the last addition computing $r_\mi$ and $r_\lo$ will be exact.
1024The same way, one can deduce the following inequalities out of the properties
1025of the \Add~ procedure. They will become useful during this proof.
1026$$\left \vert t_1 \right \vert \leq 2^{-53} \cdot \left \vert r_\hi \right \vert$$
1027$$\left \vert t_3 \right \vert \leq 2^{-53} \cdot \left \vert t_2 \right \vert$$
1028$$\left \vert t_4 \right \vert \leq 2^{-53} \cdot \left \vert t_7 \right \vert$$
1029Let us start the proof by giving bounds for the magnitude of $r_\hi$ with
1030regard to $a_\hi$:\\
1031We have on the one hand
1032\begin{eqnarray*}
1033\left \vert r_\hi \right \vert & = & \left \vert \circ\left( a_\hi + b_\hi \right) \right \vert \\
1034& = & \circ \left( \left \vert a_\hi + b_\hi \right \vert \right) \\
1035& \leq & \circ \left( \left \vert a_\hi \right \vert + \left \vert b_\hi \right \vert \right) \\
1036& \leq & \circ \left( \left \vert a_\hi \right \vert + \frac{3}{4} \cdot \left \vert a_\hi \right \vert \right) \\
1037& \leq & \circ \left( 2 \cdot \left \vert a_\hi \right \vert \right) \\
1038& = & 2 \cdot \left \vert a_\hi \right \vert
1039\end{eqnarray*}
1040and on the other
1041\begin{eqnarray*}
1042\left \vert r_\hi \right \vert & = & \circ \left( \left \vert a_\hi + b_\hi \right \vert \right) \\
1043& \geq & \circ \left( \frac{1}{4} \cdot \left \vert a_\hi \right \vert \right) \\
1044& = & \frac{1}{4} \cdot \left \vert a_\hi \right \vert
1045\end{eqnarray*}
1046So we know that $\frac{1}{4} \cdot \left \vert a_\hi \right \vert \leq \left \vert r_\hi \right \vert \leq 2 \cdot \left \vert a_\hi \right \vert$.\\
1047It is now possible to give the following upper bounds for
1048$\left \vert t_1 \right \vert$, $\left \vert t_2 \right \vert$,
1049$\left \vert t_3 \right \vert$, $\left \vert t_7 \right \vert$, $\left \vert
1050  t_4 \right \vert$, $\left \vert t_6 \right \vert$ and $\left \vert t_6 \right \vert$:
1051\begin{eqnarray*}
1052\left \vert t_1 \right \vert & \leq & 2^{-53} \cdot \left \vert r_\hi \right \vert \\
1053& \leq & 2^{-53} \cdot 2^2 \cdot \left \vert a_\hi \right \vert \\
1054& = & 2^{-51} \cdot \left \vert a_\hi \right \vert
1055\end{eqnarray*}
1056\begin{eqnarray*}
1057\left \vert t_2 \right \vert & \leq & \circ \left( \left \vert a_\mi + b_\mi \right \vert \right)  \\
1058& \leq & \circ \left( \left \vert a_\mi \right \vert + \left \vert b_\mi \right \vert \right) \\
1059& \leq & \circ \left( 2^{-\alpha_o} \cdot \left \vert a_\hi \right \vert + 2^{-\beta_o} \cdot \left \vert b_\hi \right \vert \right) \\
1060& \leq & \circ \left( 2^{-\alpha_o} \cdot \left \vert a_\hi \right \vert + 2^{-\beta_o} \cdot \frac{3}{4} \cdot \left \vert a_\hi \right \vert \right) \\
1061& \leq & \circ \left( 2^{-\min\left(\alpha_o,\beta_o\right) + 1} \cdot \left \vert a_\hi \right \vert \right) \\
1062& = & 2^{-\min\left(\alpha_o,\beta_o\right) + 1} \cdot \left \vert a_\hi \right \vert
1063\end{eqnarray*}
1064\begin{eqnarray*}
1065\left \vert t_3 \right \vert & \leq & 2^{-53} \cdot \left \vert t_2 \right \vert \\
1066& \leq & 2^{-53} \cdot 2^{-\min\left(\alpha_o,\beta_o\right) + 1} \cdot \left \vert a_\hi \right \vert \\
1067& = & 2^{-\min\left(\alpha_o,\beta_o\right)-52} \cdot \left \vert a_\hi \right \vert
1068\end{eqnarray*}
1069\begin{eqnarray*}
1070\left \vert t_7 \right \vert & \leq & \circ \left( \left \vert t_1 + t_2 \right \vert \right) \\
1071& \leq & \circ \left( \left \vert t_1 \right \vert + \left \vert t_2 \right \vert \right) \\
1072& \leq & \circ \left( 2^{-51} \cdot \left \vert a_\hi \right \vert + 2^{-\min\left(\alpha_o,\beta_o\right) + 1}
1073\cdot \left \vert a_\hi \right \vert \right) \\
1074& \leq & \circ \left( 2^{-\min\left(\alpha_o,\beta_o\right) + 2} \cdot \left \vert a_\hi \right \vert \right) \\
1075& = & 2^{-\min\left(\alpha_o,\beta_o\right) + 2} \cdot \left \vert a_\hi \right \vert
1076\end{eqnarray*}
1077\begin{eqnarray*}
1078\left \vert t_4 \right \vert & \leq & 2^{-53} \cdot \left \vert t_7 \right \vert \\
1079& \leq & 2^{-53} \cdot 2^{-\min\left(\alpha_o,\beta_o\right)+2} \cdot \left \vert a_\hi \right \vert \\
1080& = & 2^{-\min\left(\alpha_o,\beta_o\right) -51} \cdot \left \vert a_\hi \right \vert
1081\end{eqnarray*}
1082\begin{eqnarray*}
1083\left \vert t_6 \right \vert & \leq & \circ \left( \left \vert a_\lo \right \vert + \left \vert b_\lo \right \vert \right) \\
1084& \leq & \circ \left( 2^{-\alpha_o} \cdot 2^{-\alpha_u} \cdot \left \vert a_\hi \right \vert +
1085                      2^{-\beta_o} \cdot 2^{-\beta_u} \cdot \frac{3}{4} \cdot \left \vert a_\hi \right \vert \right) \\
1086& \leq & \circ \left( 2^{-\min\left(\alpha_o + \alpha_u,\beta_o + \beta_u\right) + 1} \cdot \left \vert a_\hi \right \vert \right) \\
1087& = & 2^{-\min\left(\alpha_o + \alpha_u,\beta_o + \beta_u\right) + 1} \cdot \left \vert a_\hi \right \vert
1088\end{eqnarray*}
1089and finally
1090\begin{eqnarray*}
1091\left \vert t_5 \right \vert & \leq & \circ \left( \left \vert t_3 \right \vert + \left \vert t_4 \right \vert \right) \\
1092& \leq & \circ \left( 2^{-\min\left(\alpha_o,\beta_o\right) -52} \cdot \left \vert a_\hi \right \vert +
10932^{-\min\left(\alpha_o,\beta_o\right)-51} \cdot \left \vert a_\hi \right \vert \right) \\
1094& \leq & \circ \left( 2^{-\min\left(\alpha_o,\beta_o\right) -50} \cdot \left \vert a_\hi \right \vert \right) \\
1095& = & 2^{-\min\left(\alpha_o,\beta_o\right)-50} \cdot \left \vert a_\hi \right \vert
1096\end{eqnarray*}
1097Using the fact that the addition \Add~ is exact, it is easy to show that we
1098have exactly
1099$$r_\hi + t_7 + t_3 + t_4 = a_\hi + a_\mi + b_\hi + b_\mi$$
1100Further, we can check
1101\begin{eqnarray*}
1102t_8 & = & \left( t_3 \oplus_2 t_4 \right) \oplus_1 \left( a_\lo \oplus_3 b_\lo \right) \\
1103& = & t_3 + t_4 + a_\lo + b_\lo + \delta
1104\end{eqnarray*}
1105with
1106\begin{eqnarray*}
1107\left \vert \delta \right \vert & \leq & \left \vert t_3 \right \vert \cdot \epsilon_3 + \left \vert t_4 \right \vert \cdot \epsilon_2 +
1108\left \vert a_\lo \right \vert \cdot \epsilon_3 + \left \vert b_\lo \right \vert \cdot \epsilon_3 + \left \vert t_3 \right \vert \cdot \epsilon_1
1109+ \left \vert t_4 \right \vert \cdot \epsilon_1 + \left \vert t_3 \right \vert \cdot \epsilon_1 \cdot \epsilon_2 \\
1110& & + \left \vert t_4 \right \vert \cdot \epsilon_1 \cdot \epsilon_2 + \left \vert a_\lo \right \vert \cdot \epsilon_1 +
1111\left \vert b_\lo \right \vert \cdot \epsilon_2 + \left \vert a_\lo \right \vert \cdot \epsilon_1 \cdot \epsilon_3 +
1112\left \vert b_\lo \right \vert \cdot \epsilon_1 \cdot \epsilon_3
1113\end{eqnarray*}
1114where for $i\in\left\lbrace 1,2,3 \right\rbrace$, $\epsilon_i$ is the relative
1115error bound of the floating point addition $\oplus_i$ and verifies
1116$$\left \vert \epsilon_i \right \vert \leq 2^{-53}$$
1117So we get immediately
1118$$r_\hi + r_\mi + r_\lo = r_\hi + t_7 + t_8 = \left( a_\hi + a_\mi + a_\lo \right) + \left( b_\hi + b_\mi + b_\lo \right) + \delta$$
1119Let us now express $\left \vert \left( a_\hi + a_\mi + a_\lo \right) + \left(
1120    b_\hi + b_\mi + b_\lo \right) \right \vert$
1121as a function of
1122$\left \vert a_\hi \right \vert$:
1123\begin{eqnarray*}
1124\left \vert a_\hi + a_\mi + a_\lo \right \vert & \leq & \left \vert a_\hi \right \vert + \left \vert a_\mi \right \vert +
1125\left \vert a_\lo \right \vert \\
1126& \leq & \left \vert a_\hi \right \vert + 2^{-\alpha_o} \cdot \left \vert a_\hi \right \vert +
11272^{-\alpha_o-\alpha_u} \cdot \left \vert a_\hi \right \vert \\
1128& \leq & 2 \cdot \left \vert a_\hi \right \vert
1129\end{eqnarray*}
1130and, the same way round,
1131\begin{eqnarray*}
1132\left \vert b_\hi + b_\mi + b_\lo \right \vert & \leq & 2 \cdot \left \vert b_\hi \right \vert \\
1133& \leq & \frac{3}{2} \cdot \left \vert a_\hi \right \vert
1134\end{eqnarray*}
1135which allows for noting
1136$$\left \vert \left( a_\hi + a_\mi + a_\lo \right) + \left( b_\hi + b_\mi + b_\lo \right) \right \vert \leq 2^2 \cdot \left \vert a_\hi \right \vert$$
1137In order to give a lower bound for this term, let us prove an upper bound for
1138$\left \vert b_\hi + a_\mi + b_\mi + a_\lo + b_\lo \right \vert$ as follows
1139\begin{eqnarray*}
1140\left \vert b_\hi + a_\mi + b_\mi + a_\lo + b_\lo \right \vert & \leq &
1141\left \vert b_\hi \right \vert + \left \vert a_\mi \right \vert + \left \vert b_\mi \right \vert + \left \vert a_\lo \right \vert +
1142\left \vert b_\lo \right \vert \\
1143& \leq & \frac{3}{4} \cdot \left \vert a_\hi \right \vert + 2^{-\alpha_o} \cdot \left \vert a_\hi \right \vert +
11442^{-\beta_o} \cdot \frac{3}{4} \cdot \left \vert a_\hi \right \vert + 2^{-\alpha_o-\alpha_u} \cdot \left \vert a_\hi \right \vert \\ & &
1145+ 2^{-\beta_o-\beta_u} \cdot \frac{3}{4} \cdot \left \vert a_\hi \right \vert \\
1146& \leq & \frac{7}{8} \cdot \left \vert a_\hi \right \vert
1147\end{eqnarray*}
1148So we get
1149$$\left \vert \left( a_\hi + a_\mi + a_\lo \right) + \left( b_\hi + b_\mi + b_\lo \right) \right \vert
1150\geq \frac{1}{8} \cdot \left \vert a_\hi \right \vert$$
1151Using this bounds, we can give upper bounds for the absolute error $\left
1152  \vert \delta \right \vert$ first as a function of $\left \vert a_\hi \right
1153\vert$ and than as a function of
1154$\left \vert \left( a_\hi + a_\mi + a_\lo \right) + \left( b_\hi + b_\mi +
1155    b_\lo \right) \right \vert$ for
1156deducing finally a bound for the relative error. \\
1157So we get
1158\begin{eqnarray*}
1159\left \vert \delta \right \vert & \leq & \left \vert t_3 \right \vert \cdot \epsilon_3 + \left \vert t_4 \right \vert \cdot \epsilon_2 +
1160\left \vert a_\lo \right \vert \cdot \epsilon_3 + \left \vert b_\lo \right \vert \cdot \epsilon_3 + \left \vert t_3 \right \vert \cdot \epsilon_1
1161+ \left \vert t_4 \right \vert \cdot \epsilon_1 + \left \vert t_3 \right \vert \cdot \epsilon_1 \cdot \epsilon_2 \\
1162& & + \left \vert t_4 \right \vert \cdot \epsilon_1 \cdot \epsilon_2 + \left \vert a_\lo \right \vert \cdot \epsilon_1 +
1163\left \vert b_\lo \right \vert \cdot \epsilon_2 + \left \vert a_\lo \right \vert \cdot \epsilon_1 \cdot \epsilon_3 +
1164\left \vert b_\lo \right \vert \cdot \epsilon_1 \cdot \epsilon_3 \\
1165& \leq & \left \vert a_\hi \right \vert \cdot \epsilon^\prime
1166\end{eqnarray*}
1167with
1168\begin{eqnarray*}
1169\epsilon^\prime & \leq &
11702^{-53} \cdot 2^{-\min\left(\alpha_o,\beta_o\right)-52} \\ & + &
11712^{-53} \cdot 2^{-\min\left(\alpha_o,\beta_o\right)-51} \\ & + &
11722^{-53} \cdot 2^{-\alpha_o-\alpha_u} \\ & + &
11732^{-53} \cdot 2^{-\beta_o-\beta_u} \\ & + &
11742^{-53} \cdot 2^{-\min\left(\alpha_o,\beta_o\right)-52} \\ & + &
11752^{-53} \cdot 2^{-\min\left(\alpha_o,\beta_o\right)-51} \\ & + &
11762^{-106} \cdot 2^{-\min\left(\alpha_o,\beta_o\right)-52} \\ & + &
11772^{-106} \cdot 2^{-\min\left(\alpha_o,\beta_o\right)-51} \\ & + &
11782^{-53} \cdot 2^{-\alpha_o-\alpha_u} \\ & + &
11792^{-53} \cdot 2^{-\beta_o-\beta_u} \\ & + &
11802^{-106} \cdot 2^{-\alpha_o-\alpha_u} \\ & + &
11812^{-106} \cdot 2^{-\beta_o-\beta_u} \\
1182& \leq & 2^{-\min\left(\alpha_o,\beta_o\right)-101} + 2^{-\min\left(\alpha_o+\alpha_u,\beta_o+\beta_u\right)-50}
1183\end{eqnarray*}
1184This yields to
1185$$r_\hi + r_\mi + r_\lo = \left( \left( a_\hi + a_\mi + a_\lo \right) + \left( b_\hi + b_\mi + b_\lo \right) \right) \cdot
1186\left(1 + \epsilon \right)$$
1187with
1188$$\left \vert \epsilon \right \vert \leq 2^{-\min\left(\alpha_o,\beta_o\right)-98} + 2^{-\min\left(\alpha_o+\alpha_u,\beta_o+\beta_u\right)-47}$$
1189In order to finish the prove, it suffices now to give an upper bound for the
1190maximal overlap between $r_\hi$ and $r_\mi$ because we have already shown that
1191$r_\mi$ and $r_\lo$ do not overlap at all.\\
1192So we can check
1193\begin{eqnarray*}
1194\left \vert r_8 \right \vert & \leq & \circ \left( \left \vert t_5 \right \vert + \left \vert t_6 \right \vert \right) \\
1195& \leq & \circ \left( 2^{-\min\left(\alpha_o,\beta_o\right)-50} \cdot \left \vert a_\hi \right \vert +
11962^{-\min\left(\alpha_o+\alpha_u,\beta_o+\beta_u\right)+1} \cdot \left \vert a_\hi \right \vert \right)\\
1197& \leq & \circ \left( 2^{-\min\left(\alpha_o,\beta_o\right)-48} \cdot \left \vert r_\hi \right \vert +
11982^{-\min\left(\alpha_o+\alpha_u,\beta_o+\beta_u\right)+3} \cdot \left \vert r_\hi \right \vert \right)
1199\end{eqnarray*}
1200and continue by giving the following upper bound
1201\begin{eqnarray*}
1202\left \vert r_\mi \right \vert & = & \circ \left( \left \vert t_7 + t_8 \right \vert \right) \\
1203& \leq & \circ \left( \left \vert t_7 \right \vert + \left \vert t_8 \right \vert \right) \\
1204& \leq & \circ \left( 2^{-\min\left(\alpha_o,\beta_o\right)+4} \cdot \left \vert r_\hi \right \vert +
1205\circ \left( 2^{-\min\left(\alpha_o,\beta_o\right)-48} \cdot \left \vert r_\hi \right \vert +
12062^{-\min\left(\alpha_o+\alpha_u,\beta_o+\beta_u\right)+3} \cdot \left \vert r_\hi \right \vert \right) \right) \\
1207& \leq & \circ \left( \left \vert r_\hi \right \vert \cdot \left( 2^{-\min\left(\alpha_o,\beta_u\right)+4} +
12082^{-\min\left(\alpha_o,\beta_o\right)-48} + 2^{-\min\left(\alpha+\alpha_u,\beta_o+\beta_u\right)+3} + \right. \right. \\
1209& & \left. \left. 2^{-\min\left(\alpha_o,\beta_o\right) -101} + 2^{-\min\left(\alpha_o+\alpha_u,\beta_o+\beta_u\right)-50} \right) \right) \\
1210& \leq & 2^{-\min\left(\alpha_o,\beta_o\right)+5} \cdot \left \vert r_\hi \right \vert
1211\end{eqnarray*}
1212This is the maximal overlap bound we were looking for; the proof is therefore finished.\qed
1213\end{proof}
1214\begin{theorem}[Special case of algorithm \ref{addTTref} \AddTT] ~ \\
1215Let be $a_\hi + a_\mi + a_\lo$ and $b_\hi + b_\mi + b_\lo$ the triple-double
1216arguments of algorithm \ref{addTTref} \AddTT~ such that
1217$$a_\hi = a_\mi = a_\lo = 0$$
1218So the values $r_\hi$, $r_\mi$ and $r_\lo$ returned will be exactly equal to
1219$$r_\hi + r_\mi + r_\lo = b_\hi + b_\mi + b_\lo$$
1220The values $r_\mi$ and $r_\lo$ will not overlap at all. The overlap of $r_\hi$
1221and $r_\mi$ must still be evaluated.
1222\end{theorem}
1223\begin{proof} ~\\
1224We will suppose that the \Add~ procedure is exact for $a_\hi=a_\mi=a_\lo=0$ if even we are using its unconditional
1225version. Under this hypothesis, we get thus:
1226\begin{eqnarray*}
1227r_\hi & = & \circ \left( 0 + b_\hi \right) = b_\hi \\
1228t_1 & = & 0 + b_\hi - b_\hi = 0 \\
1229t_2 & = & b_\mi \\
1230t_3 & = & 0 \\
1231t_7 & = & \circ \left( 0 + b_\mi \right) = b_\mi \\
1232t_4 & = & 0 \\
1233t_6 & = & 0 \oplus b_\lo = b_\lo \\
1234t_5 & = & 0 \oplus 0 = 0 \\
1235t_8 & = & 0 \oplus b_\lo = b_\lo \\
1236r_\mi + r_\lo & = & b_\mi + b_\lo
1237\end{eqnarray*}
1238In consequence, the following holds for the values returned:
1239$$r_\hi + r_\mi + r_\lo = b_\hi + b_\mi + b_\lo$$
1240Clearly $r_\mi$ and $r_\lo$ do not overlap because the \Add~ procedure the algorithm calls at its last line assures this
1241property.\qed
1242\end{proof}
1243\subsection{The addition operator \AddDTT}
1244Let us consider now the addition operator \AddDTT. We will only analyse a simplified case where the arguments of the
1245algorithm verify statically known bounds.
1246\begin{algorithm}[\AddDTT] \label{addDTTref} ~ \\
1247{\bf In:} a double-double number $a_\hi + a_\lo$ and a triple-double number $b_\hi + b_\mi + b_\lo$ \\
1248{\bf Out:} a triple-double number $r_\hi + r_\mi + r_\lo$ \\
1249{\bf Preconditions on the arguments:}
1250\begin{eqnarray*}
1251\left \vert b_\hi \right \vert & \leq & 2^{-2} \cdot \left \vert a_\hi \right \vert \\
1252\left \vert a_\lo \right \vert & \leq & 2^{-53} \cdot \left \vert a_\hi \right \vert \\
1253\left \vert b_\mi \right \vert & \leq & 2^{-\beta_o} \cdot \left \vert b_\hi \right \vert \\
1254\left \vert b_\lo \right \vert & \leq & 2^{-\beta_u} \cdot \left \vert b_\mi \right \vert
1255\end{eqnarray*}
1256{\bf Algorithm:} \\
1257\begin{center}
1258\begin{minipage}[b]{50mm}
1259$\left( r_\hi, t_1 \right) \gets \mAdd\left( a_\hi, b_\hi \right)$ \\
1260$\left( t_2, t_3 \right) \gets \mAdd\left( a_\lo, b_\mi \right)$ \\
1261$\left( t_4, t_5 \right) \gets \mAdd\left( t_1, t_2 \right)$ \\
1262$t_6 \gets t_3 \oplus b_\lo$ \\
1263$t_7 \gets t_6 \oplus t_5$ \\
1264$\left( r_\mi, r_\lo \right) \gets \mAdd\left( t_4, t_7 \right)$ \\
1265\end{minipage}
1266\end{center}
1267\end{algorithm}
1268\begin{theorem}[Relative error of algorithm \ref{addDTTref} \AddDTT] ~ \\
1269Let be $a_\hi + a_\lo$ and $b_\hi + b_\mi + b_\lo$ the values taken in argument of algorithm \ref{addDTTref} \AddDTT.
1270Let the preconditions hold for this values.\\
1271So the following holds for the values returned by the algorithm $r_\hi$, $r_\mi$ and $r_\lo$
1272$$r_\hi + r_\mi + r_\lo = \left(\left(a_\hi + a_\mi + a_\lo \right) + \left( b_\hi + b_\mi + b_\lo \right)\right) \cdot \left(1 + \epsilon\right)$$
1273where $\epsilon$ is bounded by
1274$$\left \vert \epsilon \right \vert \leq 2^{-\beta_o - \beta_u - 52} + 2^{-\beta_o - 104} + 2^{-153}$$
1275The values $r_\mi$ and $r_\lo$ will not overlap at all and the overlap of $r_\hi$ and $r_\mi$ will be bounded by:
1276$$\left \vert r_\mi \right \vert \leq 2^{-\gamma} \cdot \left \vert r_\hi \right \vert$$
1277with
1278$$\gamma \geq \min\left( 45, \beta_o - 4, \beta_o + \beta_u - 2 \right)$$
1279\end{theorem}
1280\begin{proof} ~ \\
1281We know using the properties of the \Add~ procedure that
1282\begin{eqnarray*}
1283r_\hi + t_1 & = & a_\hi + b_\hi \\
1284t_2 + t_3 & = & a_\lo + b_\mi \\
1285t_4 + t_5 & = & t_1 + t_2 \\
1286r_\mi + r_\lo = t_4 + t_7
1287\end{eqnarray*}
1288Supposing that we dispose already of a term of the following form
1289$$t_7 = t_5 + t_3 + b_\lo + \delta$$
1290with a bounded $\left \vert \delta \right \vert$,
1291we can note that
1292$$r_\hi + r_\mi + r_\lo = \left( a_\hi + a_\lo \right) + \left( b_\hi + b_\mi + b_\lo \right) + \delta$$
1293Let us now express $t_7$ by $t_5$, $t_3$ and $b_\lo$:
1294\begin{eqnarray*}
1295t_7 & = & t_5 \oplus t_6 \\
1296& = & t_5 \oplus \left( t_3 \oplus b_\lo \right) \\
1297& = & \left( t_5 + \left( t_3 + b_\lo \right) \cdot \left( 1 + \epsilon_1 \right) \right) \cdot \left( 1 + \epsilon_2 \right)
1298\end{eqnarray*}
1299with $\left \vert \epsilon_1 \right \vert \leq 2^{-53}$ and $\left \vert \epsilon_2 \right \vert \leq 2^{-53}$.\\
1300We get in consequence
1301$$t_7 = t_5 + t_3 + b_\lo + t_3 \cdot \epsilon_1 + b_\lo \cdot \epsilon_1 + t_5 \cdot \epsilon_2 + t_3 \cdot \epsilon_2 + b_\lo \cdot \epsilon_2 +
1302t_3 \cdot \epsilon_1 \cdot \epsilon_2 + b_\lo \cdot \epsilon_1 \cdot \epsilon_2$$
1303and we can verify that the following upper bound holds for the absolute error $\delta$:
1304\begin{eqnarray*}
1305\left \vert \delta \right \vert & = &
1306\left \vert t_3 \cdot \epsilon_1 + b_\lo \cdot \epsilon_1 + t_5 \cdot \epsilon_2 + t_3 \cdot \epsilon_2 + b_\lo \cdot \epsilon_2 +
1307t_3 \cdot \epsilon_1 \cdot \epsilon_2 + b_\lo \cdot \epsilon_1 \cdot \epsilon_2 \right \vert \\
1308& \leq & 2^{-53} \cdot \left \vert t_3 \right \vert + 2^{-53} \cdot \left \vert b_\lo \right \vert + 2^{-53} \cdot \left \vert t_5 \right \vert +
13092^{-53} \cdot \left \vert b_\lo \right \vert + 2^{-106} \cdot \left \vert t_3 \right \vert + 2^{-106} \cdot \left \vert b_\lo \right \vert \\
1310& \leq & 2^{-52} \cdot \left \vert t_3 \right \vert + 2^{-51} \cdot \left \vert b_\lo \right \vert + 2^{-53} \cdot \left \vert t_5 \right \vert
1311\end{eqnarray*}
1312Let us get now some bounds for $\left \vert t_3 \right \vert$, $\left \vert b_\lo \right \vert$ and
1313$\left \vert t_5 \right \vert$, all as a function of
1314$\left \vert a_\hi \right \vert$:
1315$$\left \vert b_\lo \right \vert \leq 2^{-\beta_o-\beta_u} \cdot \left \vert b_\hi \right \vert \leq
13162^{-\beta_o-\beta_u-2} \cdot \left \vert a_\hi \right \vert$$
1317which can be obtained using the preconditions' hypotheses. Further
1318\begin{eqnarray*}
1319\left \vert t_3 \right \vert & \leq & 2^{-53} \cdot \left \vert t_2 \right \vert \\
1320& = & 2^{-53} \cdot \left \vert \circ \left( a_\lo + b_\mi \right) \right \vert \\
1321& \leq & 2^{-52} \cdot \left \vert a_\lo + b_\mi \right \vert \\
1322& \leq & 2^{-52} \cdot \left \vert a_\lo \right \vert + 2^{-52} \cdot \left \vert b_\mi \right \vert \\
1323& \leq & 2^{-105} \cdot \left \vert a_\hi \right \vert + 2^{-\beta_o-52} \cdot \left \vert b_\hi \right \vert \\
1324& \leq & 2^{-105} \cdot \left \vert a_\hi \right \vert + 2^{-\beta_o-54} \cdot \left \vert a_\hi \right \vert
1325\end{eqnarray*}
1326and finally
1327\begin{eqnarray*}
1328\left \vert t_5 \right \vert & \leq & 2^{-53} \cdot \left \vert t_4 \right \vert \\
1329& = & 2^{-53} \cdot \left \vert \circ \left( t_1 + t_2 \right) \right \vert \\
1330& \leq & 2^{-52} \cdot \left \vert t_1 + t_2 \right \vert \\
1331& \leq & 2^{-52} \cdot \left \vert t_1 \right \vert + 2^{-52} \cdot \left \vert t_2 \right \vert \\
1332& \leq & 2^{-105} \cdot \left \vert r_\hi \right \vert + 2^{-52} \cdot \left \vert \circ \left( a_\lo + b_\mi \right) \right \vert \\
1333& \leq & 2^{-105} \cdot \left \vert \circ \left( a_\hi + b_\hi \right) \right \vert + 2^{-51} \cdot \left \vert a_\lo + b_\mi \right \vert \\
1334& \leq & 2^{-104} \cdot \left \vert a_\hi + b_\hi \right \vert + 2^{-51} \cdot \left \vert a_\lo \right \vert +
13352^{-51} \cdot \left \vert b_\mi \right \vert \\
1336& \leq & 2^{-104} \cdot \left \vert a_\hi \right \vert + 2^{-106} \cdot \left \vert a_\hi \right \vert +
13372^{-104} \cdot \left \vert a_\hi \right \vert + 2^{-\beta_o-53} \cdot \left \vert a_\hi \right \vert \\
1338& \leq & \left \vert a_\hi \right \vert \cdot \left( 2^{-102} + 2^{-\beta_o -53} \right)
1339\end{eqnarray*}
1340So we have
1341\begin{eqnarray*}
1342\left \vert \delta \right \vert & \leq & \left \vert a_\hi \right \vert \cdot
1343\left( 2^{-157} + 2^{-\beta_o-106} + 2^{-\beta_o-\beta_u-53} + 2^{-155} + 2^{-\beta_o-106} \right) \\
1344& \leq & \left \vert a_\hi \right \vert \cdot
1345\left( 2^{-\beta_o-\beta_u-53} + 2^{-\beta_o-105} + 2^{-154} \right)
1346\end{eqnarray*}
1347Let us now give a lower bound for
1348$\left \vert \left( a_\hi + a_\lo \right) + \left( b_\hi + b_\mi + b_\lo \right) \right \vert$ as a function of
1349$\left \vert a_\hi \right \vert$ by getting out an upper bound for
1350$\left \vert a_\lo + b_\hi + b_\mi + b_\lo \right \vert$ as such a function:
1351\begin{eqnarray*}
1352\left \vert a_\lo + b_\hi + b_\mi + b_\lo \right \vert & \leq &
1353\left \vert a_\lo \right \vert + \left \vert b_\hi \right \vert + \left \vert b_\mi \right \vert + \left \vert b_\lo \right \vert \\
1354& \leq & \left \vert a_\hi \right \vert \cdot \left( 2^{-53} + 2^{-2} + 2^{-\beta_o-2} + 2^{-\beta_o-\beta_u-2} \right)
1355\end{eqnarray*}
1356Since $\beta_o \geq 1$, $\beta_u \geq 1$ we can check that
1357$$\left \vert a_\lo + b_\hi + b_\mi + b_\lo \right \vert \leq 2^{-1} \cdot \left \vert a_\hi \right \vert$$
1358In consequence
1359$$\left \vert a_\hi + \left( a_\lo + b_\hi + b_\mi + b_\lo \right) \right \vert \geq \frac{1}{2} \cdot \left \vert a_\hi \right \vert$$
1360Using this lower bound, we can finally give an upper bound for the relative error $\epsilon$ of the considered procedure:
1361$$r_\hi + r_\mi + r_\lo = \left( \left( a_\hi + a_\lo \right) + \left( b_\hi + b_\mi + b_\lo \right) \right) \cdot \left( 1 + \epsilon \right)$$
1362with
1363$$\left \vert \epsilon \right \vert \leq 2^{-\beta_o-\beta_u-52} + 2^{-\beta_o-104} + 2^{-153}$$
1364Last but not least, let us now analyse the additional overlaps generated by the procedure. It is clear that
1365$r_\mi$ and $r_\lo$ do not overlap at all because they are computed by the \Add~ procedure.
1366Let us merely examine now the overlap of $r_\hi$ and $r_\mi$. \\
1367We begin by giving a lower bound for $r_\hi$ as a function of $a_\hi$:
1368\begin{eqnarray*}
1369\left \vert r_\hi \right \vert & = & \left \vert \circ \left( a_\hi + b_\hi \right) \right \vert \\
1370& \geq & \circ \left( \left \vert a_\hi + b_\hi \right \vert \right) \\
1371& \geq & \circ \left( \frac{3}{4} \cdot \left \vert a_\hi \right \vert \right) \\
1372& \geq & \circ \left( \frac{1}{2} \cdot \left \vert a_\hi \right \vert \right) \\
1373& = & \frac{1}{2} \cdot \left \vert a_\hi \right \vert
1374\end{eqnarray*}
1375Let us then find an upper bound for $\left \vert r_\mi \right \vert$
1376using also here a term which is a function of $\left \vert a_\hi \right \vert$:
1377\begin{eqnarray*}
1378\left \vert r_\mi \right \vert & = & \left \vert \circ \left( r_\mi + r_\lo \right) \right \vert \\
1379& \leq & 2 \cdot \left \vert r_\mi + r_\lo \right \vert \\
1380& = & 2 \cdot \left \vert t_4 + t_7 \right \vert \\
1381& \leq & 2 \cdot \left \vert t_4 \right \vert + 2 \cdot \left \vert t_5 + t_3 + b_\lo + \delta \right \vert \\
1382& \leq & 2 \cdot \left \vert t_4 \right \vert + 2 \cdot \left \vert t_5 \right \vert +
13832 \cdot  \left \vert t_3 \right \vert + 2 \cdot \left \vert b_\lo \right \vert + 2 \cdot \left \vert \delta \right \vert \\
1384& \leq & 2 \cdot \left \vert t_4 \right \vert + \left \vert a_\hi \right \vert \cdot \left( 2^{-101} + 2^{-\beta_o-52} \right) \\
1385& & + \left \vert a_\hi \right \vert \cdot \left( 2^{-104} + 2^{-\beta_o-53} \right) +
1386\left \vert a_\hi \right \vert \cdot 2^{-\beta_o-\beta_u-1} \\
1387& & +
1388\left \vert a_\hi \right \vert \cdot \left( 2^{-\beta_o-\beta_u-52} + 2^{-\beta_o-104} + 2^{-153}\right)
1389\end{eqnarray*}
1390By bounding finally still $\left \vert t_4 \right \vert$ by a term that is function of $\left \vert a_\hi \right \vert$
1391\begin{eqnarray*}
1392\left \vert t_4 \right \vert & = & \left \vert \circ \left( t_1 + t_2 \right) \right \vert \\
1393& \leq & 2 \cdot \left \vert t_1 \right \vert + 2 \cdot \left \vert t_2 \right \vert \\
1394& \leq & 2^{-52} \cdot \left \vert r_\hi \right \vert + 2 \cdot \left \vert \circ \left( a_\lo + b_\mi \right) \right \vert \\
1395& \leq & 2^{-51} \cdot \left \vert a_\hi + b_\hi \right \vert + 4 \cdot \left \vert a_\lo + b_\mi \right \vert \\
1396& \leq & \left \vert a_\hi \right \vert \cdot \left( 2^{-\beta_o} + 2^{-49} \right)
1397\end{eqnarray*}
1398we obtain
1399\begin{eqnarray*}
1400\left \vert r_\hi \right \vert & \leq & \left \vert a_\hi \right \vert \cdot
1401\left( 2^{-48} \right. \\
1402& & + 2^{-\beta_o+1} \\
1403& & + 2^{-101} \\
1404& & + 2^{-\beta_o-52} \\
1405& & + 2^{-104} \\
1406& & + 2^{-\beta_o-53} \\
1407& & + 2^{-\beta_o-\beta_u-1} \\
1408& & + 2^{-\beta_o-\beta_u-52} \\
1409& & + 2^{-\beta_o-104} \\
1410& & \left. + 2^{-153} \right) \\
1411& \leq & \left \vert a_\hi \right \vert \cdot
1412\left( 2^{-47} + 2^{-\beta_o+2} + 2^{-\beta_o-\beta_u} \right)
1413\end{eqnarray*}
1414We finally check that we have
1415$$\left \vert r_\mi \right \vert \leq \left \vert r_\hi \right \vert \cdot \left( 2^{-46} + 2^{-\beta_o+3} + 2^{-\beta_o-\beta_u+1} \right)$$
1416from which we can deduce the following bound
1417$$\left \vert r_\mi \right \vert \leq 2^{-\gamma} \cdot \left \vert r_\hi \right \vert$$
1418with
1419$$\gamma \geq \min\left( 45, \beta_o-4, \beta_o+\beta_u-2 \right)$$
1420This finishes the proof.\qed
1421\end{proof}
1422\section{Triple-double multiplication operators}
1423\subsection{The multiplication procedure \MulDT}
1424Let us go on with an analysis of the multiplication procedure \MulDT.
1425\begin{algorithm}[\MulDT] \label{mulDTref} ~ \\
1426{\bf In:} two double-double numbers $a_\hi + a_\lo$ and $b_\hi + b_\lo$ \\
1427{\bf Out:} a triple-double number $r_\hi + r_\mi + r_\lo$ \\
1428{\bf Preconditions on the arguments:}
1429\begin{eqnarray*}
1430\left \vert a_\lo \right \vert & \leq & 2^{-53} \cdot \left \vert a_\hi \right \vert \\
1431\left \vert b_\lo \right \vert & \leq & 2^{-53} \cdot \left \vert b_\hi \right \vert \\
1432\end{eqnarray*}
1433{\bf Algorithm:} \\
1434\begin{center}
1435\begin{minipage}[b]{50mm}
1436$\left( r_\hi, t_1 \right) \gets \mMul\left( a_\hi, b_\hi \right)$ \\
1437$\left( t_2, t_3 \right) \gets \mMul\left( a_\hi, b_\lo \right)$ \\
1438$\left( t_4, t_5 \right) \gets \mMul\left( a_\lo, b_\hi \right)$ \\
1439$t_6 \gets a_\lo \otimes b_\lo$ \\
1440$\left( t_7, t_8 \right) \gets \mAddDD\left( t_2, t_3, t_4, t_5 \right)$ \\
1441$\left( t_9, t_{10} \right) \gets \mAdd\left( t_1, t_6 \right)$ \\
1442$\left( r_\mi, r_\lo \right) \gets \mAddDD\left( t_7, t_8, t_9, t_{10} \right)$ \\
1443\end{minipage}
1444\end{center}
1445\end{algorithm}
1446\begin{theorem}[Relative error of algorithm \ref{mulDTref} \MulDT] ~ \\
1447Let be $a_\hi + a_\lo$ and $b_\hi + b_\lo$ the values taken by arguments of algorithm \ref{mulDTref} \MulDT \\
1448So the following holds for the values returned $r_\hi$, $r_\mi$ and $r_\lo$:
1449$$r_\hi + r_\mi + r_\lo = \left(\left(a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\lo \right)\right) \cdot \left(1 + \epsilon\right)$$
1450where $\epsilon$ is bounded as follows:
1451$$\left \vert \epsilon \right \vert \leq 2^{-149}$$
1452The values returned $r_\mi$ and $r_\lo$ will not overlap at all and the overlap of $r_\hi$ and $r_\mi$ will be bounded as
1453follows:
1454$$\left \vert r_\mi \right \vert \leq 2^{-48} \cdot \left \vert r_\hi \right \vert$$
1455\end{theorem}
1456\begin{proof} ~ \\
1457Since algorithm \ref{mulDTref} is relatively long, we will proceed by analysing sub-sequences. So let us consider
1458first the following sequence:
1459\begin{center}
1460\begin{minipage}[b]{50mm}
1461$\left( t_2, t_3 \right) \gets \mMul\left( a_\hi, b_\lo \right)$ \\
1462$\left( t_4, t_5 \right) \gets \mMul\left( a_\lo, b_\hi \right)$ \\
1463$\left( t_7, t_8 \right) \gets \mAddDD\left( t_2, t_3, t_4, t_5 \right)$
1464\end{minipage}
1465\end{center}
1466Clearly $t_7$ and $t_8$ will not overlap. The same way $t_2$ and $t_3$ and $t_4$ and $t_5$ will not overlap and
1467we know that we have exactly the following egalities
1468\begin{eqnarray*}
1469t_2 + t_3 & = & a_\hi \cdot b_\lo \\
1470t_4 + t_5 & = & b_\hi \cdot a_\lo
1471\end{eqnarray*}
1472Further we can check that
1473\begin{eqnarray*}
1474\left \vert t_3 \right \vert & \leq & 2^{-53} \cdot \left \vert \circ \left( a_\hi \cdot b_\lo \right) \right \vert \\
1475& \leq & 2^{-52} \cdot \left \vert a_\hi \cdot b_\lo \right \vert
1476\end{eqnarray*}
1477and similarly
1478$$\left \vert t_5 \right \vert \leq 2^{-52} \cdot \left \vert b_\hi \cdot a_\lo \right \vert$$
1479So we have on the one side
1480\begin{eqnarray*}
14812^{-53} \cdot \left \vert t_3 + t_5 \right \vert & \leq & 2^{-53} \cdot \left \vert t_3 \right \vert + 2^{-53} \cdot \left \vert t_5 \right \vert \\
1482& \leq & 2^{-105} \cdot \left \vert a_\hi \cdot b_\lo \right \vert + 2^{-105} \cdot \left \vert b_\hi \cdot a_\lo \right \vert
1483\end{eqnarray*}
1484and on the other
1485\begin{eqnarray*}
14862^{-102} \cdot \left \vert t_2 + t_3 + t_4 + t_5 \right \vert & \leq & 2^{-102} \cdot \left \vert
1487                 b_\hi \cdot a_\lo + a_\hi \cdot b_\lo \right \vert \\
1488& \leq & 2^{-102} \cdot \left \vert b_\hi \cdot a_\lo \right \vert + 2^{-102} \cdot \left \vert a_\hi \cdot b_\lo \right \vert
1489\end{eqnarray*}
1490Using theorem \ref{addDDerrabs} it is possible to note
1491$$t_7 + t_8 = a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + \delta_1$$
1492with
1493$$\left \vert \delta_1 \right \vert \leq 2^{-102} \cdot \left \vert a_\hi \cdot b_\lo \right \vert +
1494                                         2^{-102} \cdot \left \vert a_\lo \cdot b_\hi \right \vert$$
1495Let us now consider the following sub-sequence of algorithm \ref{mulDTref}:
1496\begin{center}
1497\begin{minipage}[b]{50mm}
1498$\left( r_\hi, t_1 \right) \gets \mMul\left( a_\hi, b_\hi \right)$ \\
1499$t_6 \gets a_\lo \otimes b_\lo$ \\
1500$\left( t_9, t_{10} \right) \gets \mAdd\left( t_1, t_6 \right)$
1501\end{minipage}
1502\end{center}
1503Trivially $t_9$ and $t_{10}$ do not overlap.
1504Additionally, one sees that we have exactly
1505$$r_\hi + t_1 = a_\hi \cdot b_\hi$$
1506and, exactly too,
1507$$t_9 + t_{10} = t_1 + t_6$$
1508So using
1509$$t_6 = a_\lo \otimes b_\lo = a_\lo \cdot b_\lo \cdot \left( 1 + \epsilon \right)$$
1510where $\left \vert \epsilon \right \vert \leq 2^{-53}$ we get
1511\begin{eqnarray*}
1512r_\hi + t_9 + t_{10} & = & r_\hi + t_1 + t_6 \\
1513& = & a_\hi \cdot b_\hi + t_6 \\
1514& = & a_\hi \cdot b_\hi + a_\lo \cdot b_\lo + \delta_2
1515\end{eqnarray*}
1516with
1517$$\left \vert \delta_2 \right \vert \leq 2^{-53} \cdot \left \vert a_\lo \cdot b_\lo \right \vert$$
1518Let us now bound $\left \vert t_9 \right \vert$ with regard to $\left \vert a_\hi \cdot b_\hi \right \vert$:\\
1519We have
1520\begin{eqnarray*}
1521\left \vert t_9 \right \vert & \leq & \circ \left( \left \vert t_1 \right \vert + \left \vert t_6 \right \vert \right) \\
1522& \leq & \circ \left( \left \vert t_1 \right \vert + \circ \left( \left \vert a_\lo \cdot b_\lo \right \vert \right) \right) \\
1523& \leq & \circ \left( \left \vert t_1 \right \vert + \circ \left( 2^{-106} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \right) \right) \\
1524& \leq & \circ \left( 2^{-53} \cdot \left \vert a_\hi \cdot b_\hi \right \vert + 2^{-105} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \right) \\
1525& \leq & 2^{-51} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1526\end{eqnarray*}
1527With inequalities given, we can bound now the absolute and relative error of algorithm \MulDT~ \ref{mulDTref}. \\
1528We know already that
1529$$t_7 + t_8 = a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + \delta_1$$
1530where
1531$$\left \vert \delta_1 \right \vert \leq 2^{-102} \cdot \left \vert a_\hi \cdot b_\lo \right \vert +
1532                                         2^{-102} \cdot \left \vert b_\hi \cdot a_\lo \right \vert$$
1533and
1534$$r_\hi + t_9 + t_{10} = a_\hi \cdot b_\hi + a_\lo \cdot b_\lo + \delta_2$$
1535where
1536$$\left \vert \delta_2 \right \vert \leq 2^{-53} \cdot \left \vert a_\lo \cdot b_\lo \right \vert$$
1537One remarks that
1538\begin{eqnarray*}
1539\left \vert t_8 \right \vert & \leq & 2^{-53} \cdot \left \vert t_7 \right \vert \\
1540\left \vert t_{10} \right \vert & \leq & 2^{-53} \cdot \left \vert t_9 \right \vert
1541\end{eqnarray*}
1542and easily checks that
1543$$2^{-53} \cdot \left \vert t_{10} + t_8 \right \vert \leq 2^{-101} \cdot \left \vert t_9 \right \vert + 2^{-101} \cdot \left \vert t_7 \right \vert$$
1544and that
1545$$2^{-102} \cdot \left \vert t_9 + t_{10} + t_7 + t_8 \right \vert \leq 2^{-101} \cdot \left \vert t_9 \right \vert +
1546                                                                        2^{-101} \cdot \left \vert t_7 \right \vert$$
1547So by means of the theorem \ref{addDDerrabs}, we obtain that
1548$$r_\mi + r_\lo = t_9 + t_{10} + t_7 + t_8 + \delta_3$$
1549where
1550$$\left \vert \delta_3 \right \vert \leq 2^{-101} \cdot \left \vert t_9 \right \vert + 2^{-101} \cdot \left \vert t_7 \right \vert$$
1551So finally we get
1552$$r_\hi + r_\mi + r_\lo = a_\hi \cdot b_\hi + a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\lo + \delta$$
1553where
1554\begin{eqnarray*}
1555\left \vert \delta \right \vert & = & \left \vert \delta_1 + \delta_2 + \delta_3 \right \vert \\
1556& \leq & \left \vert \delta_1 \right \vert + \left \vert \delta_2 \right \vert + \left \vert \delta_3 \right \vert \\
1557& \leq & 2^{-102} \cdot \left \vert a_\lo \cdot b_\hi \right \vert \\
1558& & + 2^{-102} \cdot \left \vert a_\hi \cdot b_\lo \right \vert \\
1559& & + 2^{-53} \cdot \left \vert a_\lo \cdot b_\lo \right \vert \\
1560& & + 2^{-152} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \\
1561& & + 2^{-101} \cdot \left \vert t_7 \right \vert
1562\end{eqnarray*}
1563And for $\left \vert t_7 \right \vert$ we obtain the following inequalities
1564\begin{eqnarray*}
1565\left \vert t_7 \right \vert & \leq & \circ \left( \left \vert t_7 + t_8 \right \vert \right) \\
1566& \leq & 2 \cdot \left \vert t_7 + t_8 \right \vert \\
1567& \leq & 2 \cdot \left(\left \vert a_\hi \cdot b_\lo \right \vert +
1568                       \left \vert a_\lo \cdot b_\hi \right \vert +
1569                       2^{-102} \cdot \left \vert a_\lo \cdot b_\hi \right \vert +
1570                       2^{-102} \cdot \left \vert a_\hi \cdot b_\lo \right \vert \right) \\
1571& \leq & 8 \cdot \left \vert a_\hi \cdot b_\lo \right \vert
1572\end{eqnarray*}
1573In consequence we can check
1574$$\left \vert \delta \right \vert \leq 2^{-150} \cdot \left \vert a_\hi \cdot b_\hi \right \vert$$
1575Let us give now an upper bound for $\left \vert a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\lo \right \vert$ as a function of
1576$\left \vert a_\hi \cdot b_\hi \right \vert$:\\
1577We have
1578\begin{eqnarray*}
1579\left \vert a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\lo \right \vert & \leq &
1580\left \vert a_\hi \cdot b_\lo \right \vert + \left \vert a_\lo \cdot b_\hi \right \vert + \left \vert a_\lo \cdot b_\lo \right \vert \\
1581& \leq & 2^{-51} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1582\end{eqnarray*}
1583from which we deduce that
1584\begin{eqnarray*}
1585\left \vert a_\hi \cdot b_\hi + \left( a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\lo \right) \right \vert & \geq &
1586\left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 1 - 2^{-51} \right) \\
1587& \geq & \frac{1}{2} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1588\end{eqnarray*}
1589Thus
1590$$\left \vert \delta \right \vert \leq
15912^{-149} \cdot \left \vert a_\hi \cdot b_\hi + a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\lo \right \vert$$
1592So we can finally give an upper bound for the relative error $\epsilon$ of the multiplication procedure \MulDT~
1593defined by algorithm \ref{mulDTref}:
1594$$r_\hi + r_\mi + r_\lo = \left( a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\lo \right) \cdot \left( 1 + \epsilon \right)$$
1595with
1596$$\left \vert \epsilon \right \vert \leq 2^{-149}$$
1597Before concluding, we must still analyse the overlap of the different components of the triple-double number returned
1598by the algorithm. It is clear that $r_\mi$ and $r_\lo$ do not overlap because the \AddDD~ brick ensures this.
1599Let us now consider the magnitude of $r_\mi$ with regard to the one of $r_\hi$.\\
1600We give first a lower bound for $\left \vert r_\hi \right \vert$:
1601\begin{eqnarray*}
1602\left \vert r_\hi \right \vert & = & \left \vert \circ \left( a_\hi \cdot b_\hi \right) \right \vert \\
1603& \geq & \circ \left( \left \vert a_\hi \cdot b_\hi \right \vert \right) \\
1604& \geq & \frac{1}{2} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1605\end{eqnarray*}
1606and then an upper bound for $\left \vert r_\mi \right \vert$:
1607\begin{eqnarray*}
1608\left \vert r_\mi \right \vert & \leq & \circ \left( \left \vert r_\mi + r_\lo \right \vert \right) \\
1609& \leq & \circ \left( \left \vert t_7 + t_8 \right \vert + \left \vert t_9 + t_{10} \right \vert + \delta_3 \right) \\
1610& \leq & \circ \left( \left \vert a_\hi \cdot b_\lo \right \vert + \left \vert a_\lo \cdot b_\hi \right \vert + \delta_1 +
1611                      \left \vert t_9 \right \vert + \left \vert t_{10} \right \vert + \delta_3 \right) \\
1612& \leq & \circ \left( \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left(
1613                      2^{-53} + 2^{-53} + 2^{-155} + 2^{-155} + 2^{-51} + 2^{-104} + 2^{-152} + 2^{-151} \right) \right) \\
1614& \leq & 2^{-49} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1615\end{eqnarray*}
1616From this we can deduce the final bound
1617$$\left \vert r_\mi \right \vert \leq 2^{-48} \cdot \left \vert r_\hi \right \vert$$\qed
1618\end{proof}
1619\subsection{The multiplication procedure \MulDTT}
1620Let us concentrate now on the multiplication sequence \MulDTT.
1621\begin{algorithm}[\MulDTT] \label{mulDTTref} ~ \\
1622{\bf In:} a double-double number $a_\hi + a_\lo$  and a triple-double number $b_\hi + b_\mi + b_\lo$ \\
1623{\bf Out:} a triple-double number $r_\hi + r_\mi + r_\lo$ \\
1624{\bf Preconditions on the arguments:}
1625\begin{eqnarray*}
1626\left \vert a_\lo \right \vert & \leq & 2^{-53} \cdot \left \vert a_\hi \right \vert \\
1627\left \vert b_\mi \right \vert & \leq & 2^{-\beta_o} \cdot \left \vert b_\hi \right \vert \\
1628\left \vert b_\lo \right \vert & \leq & 2^{-\beta_u} \cdot \left \vert b_\mi \right \vert
1629\end{eqnarray*}
1630with
1631\begin{eqnarray*}
1632\beta_o & \geq & 2 \\
1633\beta_u & \geq & 1
1634\end{eqnarray*}
1635{\bf Algorithm:} \\
1636\begin{center}
1637\begin{minipage}[b]{60mm}
1638$\left( r_\hi, t_1 \right) \gets \mMul\left( a_\hi, b_\hi \right)$ \\
1639$\left( t_2, t_3 \right) \gets \mMul\left( a_\hi, b_\mi \right)$ \\
1640$\left( t_4, t_5 \right) \gets \mMul\left( a_\hi, b_\lo \right)$ \\
1641$\left( t_6, t_7 \right) \gets \mMul\left( a_\lo, b_\hi \right)$ \\
1642$\left( t_8, t_9 \right) \gets \mMul\left( a_\lo, b_\mi \right)$ \\
1643$t_{10} \gets a_\lo \otimes b_\lo$ \\
1644$\left( t_{11}, t_{12} \right) \gets \mAddDD\left( t_2, t_3, t_4, t_5 \right)$ \\
1645$\left( t_{13}, t_{14} \right) \gets \mAddDD\left( t_6, t_7, t_8, t_9 \right)$ \\
1646$\left( t_{15}, t_{16} \right) \gets \mAddDD\left( t_{11}, t_{12}, t_{13}, t_{14} \right)$ \\
1647$\left( t_{17}, t_{18} \right) \gets \mAdd\left( t_1, t_{10} \right)$ \\
1648$\left( r_\mi, r_\lo \right) \gets \mAddDD\left( t_{17}, t_{18}, t_{15}, t_{16} \right)$ \\
1649\end{minipage}
1650\end{center}
1651\end{algorithm}
1652\begin{theorem}[Relative error of algorithm \ref{mulDTTref} \MulDTT] ~ \\
1653Let be $a_\hi + a_\lo$ and $b_\hi + b_\mi + b_\lo$ the values in argument of algorithm \ref{mulDTTref} \MulDTT~ such that
1654the given preconditions hold.\\
1655So the following will hold for the values $r_\hi$, $r_\mi$ and $r_\lo$ returned
1656$$r_\hi + r_\mi + r_\lo = \left(\left(a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\mi + b_\lo \right)\right) \cdot \left(1 + \epsilon\right)$$
1657where $\epsilon$ is bounded as follows:
1658$$\left \vert \epsilon \right \vert \leq \frac{2^{-99 - \beta_o} + 2^{-99 - \beta_o - \beta_u} + 2^{-152}}
1659                                              {1 - 2^{-53} - 2^{-\beta_o + 1} - 2^{-\beta_o - \beta_u + 1}}
1660                                    \leq 2^{-97 - \beta_o} + 2^{-97 - \beta_o - \beta_u} + 2^{-150}$$
1661The values $r_\mi$ and  $r_\lo$ will not overlap at all and the following bound will be verified for the overlap of
1662$r_\hi$ and $r_\mi$:
1663$$\left \vert r_\mi \right \vert \leq 2^{-\gamma} \cdot \left \vert r_\hi \right \vert$$
1664where
1665$$\gamma \geq \min\left( 48, \beta_o - 4, \beta_o + \beta_u - 4 \right)$$
1666\end{theorem}
1667\begin{proof} ~ \\
1668During this proof we will once again proceed by basic bricks that we will assemble in the end.\\
1669Let us therefore start by the following one:
1670\begin{center}
1671\begin{minipage}[b]{60mm}
1672$\left( t_2, t_3 \right) \gets \mMul\left( a_\hi, b_\mi \right)$ \\
1673$\left( t_4, t_5 \right) \gets \mMul\left( a_\hi, b_\lo \right)$ \\
1674$\left( t_{11}, t_{12} \right) \gets \mAddDD\left( t_2, t_3, t_4, t_5 \right)$
1675\end{minipage}
1676\end{center}
1677Since we have the exact egalities
1678$$t_2 + t_3 = a_\hi \cdot b_\mi$$
1679and
1680$$t_4 + t_5 = a_\hi \cdot b_\lo$$
1681and since we know that $t_2$ and $t_3$ and $t_4$ and $_5$ do not overlap,
1682it suffices to apply the bound proven at theorem \ref{addDDerrabs}.
1683So we can check on the one hand
1684\begin{eqnarray*}
16852^{-53} \cdot \left \vert t_3 + t_5 \right \vert & \leq & 2^{-53} \cdot \left \vert t_3 \right \vert + 2^{-53} \cdot \left \vert t_5 \right \vert \\
1686& \leq & 2^{-106} \cdot \left \vert t_2 \right \vert + 2^{-106} \cdot \left \vert t_4 \right \vert \\
1687& \leq & 2^{-105} \cdot \left \vert a_\hi \cdot b_\mi \right \vert + 2^{-105} \cdot \left \vert a_\hi \cdot b_\lo \right \vert \\
1688& \leq & 2^{-105-\beta_o} \cdot \left \vert a_\hi \cdot b_\mi \right \vert + 2^{-105-\beta_o-\beta_u} \cdot \left \vert a_\hi \cdot b_\lo \right \vert
1689\end{eqnarray*}
1690and on the other
1691\begin{eqnarray*}
16922^{-102} \cdot \left \vert t_2 + t_3 + t_4 + t_5 \right \vert & = &
16932^{-102} \cdot \left \vert a_\hi \cdot b_\mi + a_\hi \cdot b_\lo \right \vert \\
1694& \leq & 2^{-102} \cdot \left \vert a_\hi \cdot b_\mi \right \vert + 2^{-102} \cdot \left \vert a_\hi \cdot b_\lo \right \vert \\
1695& \leq & 2^{-102-\beta_o} \cdot \left \vert a_\hi \cdot b_\hi \right \vert + 2^{-102-\beta_o-\beta_u} \cdot \left \vert a_\hi \cdot b_\lo \right \vert
1696\end{eqnarray*}
1697In consequence, using the mentioned theorem, we obtain
1698$$t_{11} + t_{12} = a_\hi \cdot b_\mi + a_\hi \cdot b_\lo + \delta_1$$
1699with
1700$$\left \vert \delta_1 \right \vert \leq
17012^{-102-\beta_o} \cdot \left \vert a_\hi \cdot b_\hi \right \vert + 2^{-102-\beta_o-\beta_u} \cdot \left \vert a_\hi \cdot b_\lo \right \vert$$
1702Let us continue with the following part of the algorithm:
1703\begin{center}
1704\begin{minipage}[b]{60mm}
1705$\left( t_6, t_7 \right) \gets \mMul\left( a_\lo, b_\hi \right)$ \\
1706$\left( t_8, t_9 \right) \gets \mMul\left( a_\lo, b_\mi \right)$ \\
1707$\left( t_{13}, t_{14} \right) \gets \mAddDD\left( t_6, t_7, t_8, t_9 \right)$
1708\end{minipage}
1709\end{center}
1710We have
1711\begin{eqnarray*}
17122^{-53} \cdot \left \vert t_7 + t_9 \right \vert & \leq & 2^{-53} \cdot \left \vert t_7 \right \vert + 2^{-53} \cdot \left \vert t_9 \right \vert \\
1713& \leq & 2^{-106} \cdot \left \vert t_6 \right \vert + 2^{-106} \cdot \left \vert t_8 \right \vert \\
1714& \leq & 2^{-105} \cdot \left \vert a_\lo \cdot b_\hi \right \vert + 2^{-105} \cdot \left \vert a_\lo \cdot b_\mi \right \vert \\
1715& \leq & 2^{-158} \cdot \left \vert a_\hi \cdot b_\hi \right \vert + 2^{-158-\beta_o} \cdot \left \vert a_\hi b_\hi \right \vert
1716\end{eqnarray*}
1717and
1718\begin{eqnarray*}
17192^{-102} \cdot \left \vert t_6 + t_7 + t_8 + t_9 \right \vert & = &  2^{-102} \cdot \left \vert a_\lo \cdot b_\hi + a_\lo \cdot b_\mi \right \vert \\
1720& \leq & 2^{-102} \cdot \left \vert a_\lo \cdot b_\hi \right \vert + 2^{-102} \cdot \left \vert a_\lo \cdot b_\mi \right \vert \\
1721& \leq & 2^{-155} \cdot \left \vert a_\hi \cdot b_\hi \right \vert + 2^{-155-\beta_o} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1722\end{eqnarray*}
1723So we get
1724$$t_{13} + t_{14} = a_\lo \cdot b_\hi + a_\lo \cdot b_\mi + \delta_2$$
1725with
1726$$\left \vert \delta_2 \right \vert \leq
17272^{-155} \cdot \left \vert a_\hi \cdot b_\hi \right \vert + 2^{-155-\beta_o} \cdot \left \vert a_\hi \cdot b_\hi \right \vert$$
1728Let us now consider the brick that produces $t_{15}$ and $t_{16}$ out of the values in argument.
1729By the properties of the \AddDD~ procedure, $t_{11}$ and $t_{12}$ and $t_{13}$ and $t_{14}$ do not overlap at all and
1730verify thus the preconditions of the next \AddDD~ brick that will compute $t_{15}$ and $t_{16}$.
1731So it suffices to apply once again the absolute error bound of this procedure for obtaining
1732$$t_{15} + t_{16} = t_{11} + t_{12} + t_{13} + t_{14} + \delta_3$$ with $\left \vert \delta_3 \right \vert$ which remains to be
1733estimated.\\
1734So we have on the one hand
1735\begin{eqnarray*}
17362^{-53} \cdot \left \vert t_{12} + t_{14} \right \vert & \leq & 2^{-53} \cdot \left \vert t_{12} \right \vert + 2^{-53} \cdot
1737\left \vert t_{14} \right \vert \\
1738& \leq & 2^{-106} \cdot \left \vert t_{11} \right \vert + 2^{-106} \cdot \left \vert t_{13} \right \vert
1739\end{eqnarray*}
1740-- which is an upper bound that can still be estimated by
1741\begin{eqnarray*}
1742\left \vert t_{11} \right \vert & = & \left \vert \circ \left( t_{11} + t_{12} \right) \right \vert \\
1743& \leq & \left \vert \left( t_{11} + t_{12} \right) \cdot \left( 1 + 2^{-53} \right) \right \vert \\
1744& \leq & 2 \cdot \left \vert t_{11} + t_{12} \right \vert \\
1745& \leq & 2 \cdot \left \vert a_\hi \cdot b_\mi + a_\hi \cdot b_\lo + \delta_1 \right \vert \\
1746& \leq & 2 \cdot \left( \left \vert a_\hi \cdot b_\mi \right \vert + \left \vert a_\hi \cdot b_\lo \right \vert + \left \vert \delta_1 \right \vert
1747\right) \\
1748& \leq & 2 \cdot \left( 2^{-\beta_o} \cdot \left \vert a_\hi \cdot b_\hi \right \vert +
17492^{-\beta_o-\beta_u} \cdot \left \vert a_\hi \cdot b_\hi \right \vert +
17502^{-\beta_o-102} \cdot \left \vert a_\hi \cdot b_\hi \right \vert + 2^{-\beta_o-\beta_u-102} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \right) \\
1751& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-\beta_o+2} + 2^{-\beta_o-\beta_u+2} \right)
1752\end{eqnarray*}
1753which means, using also the following inequalities that
1754\begin{eqnarray*}
1755\left \vert t_{13} \right \vert & = & \left \vert \circ \left( t_{13} + t_{14} \right) \right \vert \\
1756& \leq & 2 \cdot \left \vert t_{13} + t_{14} \right \vert \\
1757& \leq & 2 \cdot \left \vert a_\lo \cdot b_\hi + a_\lo \cdot b_\mi + \delta_2 \right \vert \\
1758& \leq & 2 \cdot \left( \left \vert a_\lo \cdot b_\hi \right \vert + \left \vert a_\lo \cdot b_\mi \right \vert + \left \vert \delta_2 \right \vert
1759\right) \\
1760& \leq & 2 \cdot \left( 2^{-53} \cdot \left \vert a_\hi \cdot b_\hi \right \vert +
17612^{-53-\beta_o} \cdot \left \vert a_\hi \cdot b_\hi \right \vert +
17622^{-155} \cdot \left \vert a_\hi \cdot b_\hi \right \vert +
17632^{-155-\beta_o} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1764\right) \\
1765& \leq & 2^{-50} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1766\end{eqnarray*}
1767we can finally check that we have on the one side
1768$$2^{-53} \cdot \left \vert t_{12} + t_{14} \right \vert \leq \left \vert a_\hi \cdot b_\hi \right \vert \cdot
1769\left( 2^{-\beta_o-104} + 2^{-\beta_o-\beta_u-104} + 2^{-156} \right)$$
1770And on the other
1771\begin{eqnarray*}
17722^{-102} \cdot \left \vert t_{11} + t_{12} + t_{13} + t_{14} \right \vert & \leq &
17732^{-102} \cdot \left \vert a_\hi \cdot b_\mi + a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\mi + \delta_1 + \delta_2 \right \vert \\
1774& \leq & 2^{-102} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \cdot \\
1775& & \left( 2^{-\beta_o} \right. \\ & & + 2^{-\beta_o-\beta_u} \\ & & + 2^{-53} \\ & & + 2^{-\beta_o-53} \\ & & + 2^{-\beta_o-102} \\
1776& & + 2^{-\beta_o-\beta_u-102} \\ & & + 2^{-155} \\ & & \left. + 2^{-\beta_o-155} \right) \\
1777& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left(
17782^{-\beta_o-101} + 2^{-\beta_o-\beta_u-101} + 2^{-154} \right)
1779\end{eqnarray*}
1780So we know that
1781$$t_{15} + t_{16} = t_{11} + t_{12} + t_{13} + t_{14} + \delta_3$$
1782with
1783$$\left \vert \delta_3 \right \vert \leq \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left(
17842^{-\beta_o-101} + 2^{-\beta_o-\beta_u-101} + 2^{-154} \right)$$
1785With this result we can note now
1786$$t_{15} + t_{16} = a_\hi \cdot b_\mi + a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\mi + \delta_4$$
1787with
1788\begin{eqnarray*}
1789\left \vert \delta_4 \right \vert & \leq &
1790\left \vert a_\hi \cdot b_\hi \right \vert \cdot \\
1791& & \left( 2^{-\beta_o-102} \right. \\
1792& & + 2^{-\beta_o-\beta_u-102} \\
1793& & + 2^{-155} \\
1794& & + 2^{-\beta_o-155} \\
1795& & + 2^{-\beta_o-101} \\
1796& & \left. + 2^{-\beta_o-\beta_u-101} \right) \\
1797& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-\beta_o-100} + 2^{-\beta_o-\beta_u-100} + 2^{-155} \right)
1798\end{eqnarray*}
1799Let us give now an upper bound for $\delta_5$ defined by the following expression:
1800$$r_\mi + r_\lo = t_1 + a_\lo \cdot b_\lo + t_{15} + t_{16} + \delta_5$$
1801It is clear that $t_{17}$ and $t_{18}$ do not overlap. In contrast the \Add~ operation which adds $t_1$ to $t_{10}$ is
1802necessary because $t_1$ and $t_{10}$ can overlap and even \ouvguill overtake\fermguill~ each other:
1803$$\left \vert t_1 \right \vert \geq 2^{-106} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \lor t_1 = 0$$
1804and
1805$$\left \vert t_{10} \right \vert \leq 2^{-\beta_o-\beta_u-52} \cdot \left \vert a_\hi \cdot b_\hi \right \vert$$
1806The same argument tells us that the \Add~ must be conditional. \\
1807So we have
1808$$t_{17} + t_{18} = t_1 + t_{10}$$
1809and
1810$$t_{10} = a_\lo \cdot b_\lo + \delta^\prime$$
1811with
1812$$\left \vert \delta^\prime \right \vert \leq 2^{-106-\beta_o-\beta_u} \cdot \left \vert a_\hi \cdot b_\hi \right \vert$$
1813Let us apply once again the bound for the absolute error of the \AddDD~ procedure:\\
1814So we have on the one hand
1815\begin{eqnarray*}
18162^{-53} \cdot \left \vert t_{18} + t_{16} \right \vert & \leq &
18172^{-53} \cdot \left \vert t_{18} \right \vert + 2^{-53} \cdot \left \vert t_{18} \right \vert \\
1818& \leq & 2^{-106} \cdot \left \vert t_{17} \right \vert + 2^{-106} \cdot \left \vert t_{15} \right \vert
1819\end{eqnarray*}
1820We can estimate this by
1821\begin{eqnarray*}
1822\left \vert t_{17} \right \vert & \leq & \left \vert \circ \left( t_1 + t_{10} \right) \right \vert \\
1823& \leq & 2 \cdot \left \vert t_1 + t_{10} \right \vert \\
1824& \leq & 2 \cdot \left \vert t_1 \right \vert + 2 \cdot \left \vert t_{10} \right \vert \\
1825& \leq & 2^{-52} \cdot \left \vert r_\hi \right \vert + 2 \cdot \left \vert \circ \left( a_\lo \cdot b_\lo \right) \right \vert \\
1826& \leq & 2^{-52} \cdot \left \vert \circ \left( a_\hi \cdot b_\hi \right) \right \vert + 2^2 \cdot \left \vert a_\lo \cdot b_\lo \right \vert \\
1827& \leq & 2^{-51} \cdot \left \vert a_\hi \cdot b_\hi \right \vert + 2^{-51-\beta_o-\beta_u} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1828\end{eqnarray*}
1829and by
1830\begin{eqnarray*}
1831\left \vert t_{15} \right \vert & = & \left \vert \circ \left( t_{15} + t_{16} \right) \right \vert \\
1832& \leq & 2 \cdot \left \vert t_{15} + t_{16} \right \vert \\
1833& \leq & 2 \cdot \left \vert
1834a_\hi \cdot b_\mi + a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\mi + \delta_4 \right \vert \\
1835& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left(
18362^{-\beta_o+1} + 2^{-\beta_o-\beta_u+1} + 2^{-52} + 2^{-\beta_o-52} + 2^{-\beta_o-99} + 2^{-\beta_o-\beta_u-99} + 2^{-154}  \right) \\
1837& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-\beta_o+2} + 2^{-\beta_o-\beta_u+2} + 2^{-51}  \right)
1838\end{eqnarray*}
1839So finally, we have on the one hand
1840\begin{eqnarray*}
18412^{-53} \cdot \left \vert t_{18} + t_{16} \right \vert & \leq &
1842\left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-157} + 2^{-157-\beta_o-\beta_u} + 2^{-104-\beta_o} +
18432^{-104-\beta_o-\beta_u} + 2^{-157}  \right) \\
1844& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-\beta_o-104} + 2^{-\beta_o-\beta_u-103} + 2^{-156} \right)
1845\end{eqnarray*}
1846And on the other
1847\begin{eqnarray*}
18482^{-102} \cdot \left \vert t_{17} + t_{18} + t_{15} + t_{16} \right \vert & \leq &
18492^{-102} \cdot \left \vert t_1 + a_\lo \cdot b_\lo + \delta^\prime + a_\hi \cdot b_\mi + a_\hi \cdot b_\lo +
1850a_\lo \cdot b_\hi \right. \\ & & \left. + a_\lo \cdot b_\mi + \delta_4 \right \vert \\
1851& \leq & 2^{-102} \cdot \left( 2^{-53} \cdot \left \vert r_\hi \right \vert \right. \\
1852& & + 2^{-53-\beta_o-\beta_u} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \\
1853& & + 2^{-\beta_o} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \\
1854& & + 2^{-\beta_o-\beta_u} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \\
1855& & + 2^{-53} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \\
1856& & + 2^{-53-\beta_o} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \\
1857& & + 2^{-106-\beta_o-\beta_u} \cdot \left \vert a_\hi \cdot b_\hi \right \vert \\
1858& & \left. + \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-100-\beta_o} + 2^{-100-\beta_o-\beta_u} + 2^{-155} \right) \right) \\
1859& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-101-\beta_o} + 2^{-101-\beta_o-\beta_u} + 2^{-153} \right)
1860\end{eqnarray*}
1861which means that we finally obtain the following
1862$$r_\mi + r_\lo = t_1 + a_\lo \cdot b_\lo + a_\hi \cdot b_\mi + a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\mi + \delta_6$$
1863with
1864$$\left \vert \delta_6 \right \vert \leq \left \vert \delta_4 + \delta_5 \right \vert$$
1865where
1866$$\left \vert \delta_5 \right \vert \leq
1867\left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-101-\beta_o} + 2^{-101-\beta_o-\beta_u} + 2^{-153} \right)$$
1868Thus we can check that
1869\begin{eqnarray*}
1870\left \vert \delta_6 \right \vert & \leq &
1871\left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-100-\beta_o} + 2^{-100-\beta_o-\beta_u} + 2^{-155} +
18722^{-101-\beta_o} + 2^{-101-\beta_o-\beta_u} + 2^{-153} \right) \\
1873& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-99-\beta_o} + 2^{-99-\beta_o-\beta_u} + 2^{-152} \right)
1874\end{eqnarray*}
1875Let us now integrate the different intermediate results:\\
1876Since we know that the following egality is exact
1877$$r_\hi + t_1 = a_\hi \cdot b_\hi$$
1878we can check that
1879$$r_\hi + r_\mi + r_\lo = \left( a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\mi + b_\lo \right) + \delta_6$$
1880We continue by giving a lower bound for
1881$\left \vert \left( a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\mi + b_\lo \right) \right \vert$
1882using a term which is a function of $\left \vert a_\hi \cdot b_\hi \right \vert$. We do so for being able to give
1883a relative error bound.
1884We first bound $$\left \vert a_\hi \cdot b_\mi + a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\mi + a_\lo \cdot b_\lo \right \vert$$
1885by such a term.\\
1886We have
1887\begin{eqnarray*}
1888\left \vert a_\hi \cdot b_\mi + a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\mi + a_\lo \cdot b_\lo \right \vert & \leq &
1889\left \vert a_\hi \cdot b_\mi \right \vert +
1890\left \vert a_\hi \cdot b_\lo \right \vert +
1891\left \vert a_\lo \cdot b_\hi \right \vert +
1892\left \vert a_\lo \cdot b_\mi \right \vert +
1893\left \vert a_\lo \cdot b_\lo \right \vert \\
1894& \leq & \left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 2^{-\beta_o}  +
18952^{-\beta_o-\beta_u} +
18962^{-53}  \right. \\ & & \left.  +
18972^{-\beta_o-53} +
18982^{-\beta_o-53} \right) \\
1899& \leq & 2^{-\beta_o+1} \cdot \left \vert a_\hi \cdot b_\hi \right \vert +
19002^{-\beta_o-\beta_u+1} \cdot \left \vert a_\hi \cdot b_\hi \right \vert  \\ & & +
19012^{-53} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1902\end{eqnarray*}
1903and we get
1904$$\left \vert \left( a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\mi + b_\lo \right) \right \vert \geq
1905\left \vert a_\hi \cdot b_\hi \right \vert \cdot \left( 1 - 2^{-53} - 2^{-\beta_o+1} -2^{-\beta_o-\beta_u+1} \right)$$
1906from which we deduce (since $\beta_o \geq 2$, $\beta_u \geq 1$)
1907$$\left \vert a_\hi \cdot b_\hi \right \vert \leq \frac{1}{1 - 2^{-53} - 2^{-\beta_o+1} -2^{-\beta_o-\beta_u+1}} \cdot
1908\left \vert \left( a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\mi + b_\lo \right) \right \vert$$
1909Using this inequality we can finally give a bound for the relative error $\epsilon$ as follows:
1910$$r_\hi + r_\mi + r_\lo = \left( a_\hi + a_\lo \right) \cdot \left( b_\hi + b_\mi + b_\lo \right) \cdot \left( 1 + \epsilon \right)$$
1911with
1912$$\left \vert \epsilon \right \vert \leq
1913\frac{2^{-99-\beta_o} + 2^{-99-\beta_o-\beta_u} + 2^{-152}}{1 - 2^{-53} - 2^{-\beta_o+1} -2^{-\beta_o-\beta_u+1}}$$
1914Let us recall that for this inequality, $\beta_o \geq 2$, $\beta_u \geq 1$ must hold which is the case.\\
1915It is certainly possible to estimate $\left \vert \epsilon \right \vert$ by a term which is slightly less exact:
1916$$\left \vert \epsilon \right \vert \leq 2^{-97 - \beta_o} + 2^{-97 - \beta_o - \beta_u} + 2^{-150}$$
1917because
1918$$1 - 2^{-53} - 2^{-\beta_o+1} -2^{-\beta_o-\beta_u+1} \geq \frac{1}{4}$$
1919for $\forall \beta_o \geq 2, \beta_u \geq 1$.\\~\\
1920In order to finish this proof, we must still give an upper bound for the maximal overlap generated by the
1921algorithm \ref{mulDTTref} \MulDTT.
1922Clearly $r_\mi$ and $r_\lo$ do not overlap because of the properties of the basic brick \AddDD.
1923Let us give an upper bound for the overlap between $r_\hi$ and $r_\mi$ giving a term of the following form:
1924$$\left \vert r_\mi \right \vert \leq 2^{-\gamma} \cdot \left \vert r_\hi \right \vert$$
1925where we constate a lower bound for $\gamma$ using a term in $\beta_o$ and $\beta_u$.\\
1926Let us start by giving a lower bound for $r_\hi$ as a function of $\left \vert a_\hi \cdot b_\hi \right \vert$.\\ We have
1927\begin{eqnarray*}
1928\left \vert r_\hi \right \vert & = & \left \vert \circ \left( a_\hi \cdot b_\hi \right) \right \vert \\
1929& \geq & \frac{1}{2} \cdot \left \vert a_\hi \cdot b_\hi \right \vert
1930\end{eqnarray*}
1931Then, let us give an upper bound for $\left \vert r_\mi \right \vert$ using a function of
1932$\left \vert a_\hi \cdot b_\hi \right \vert$:
1933\begin{eqnarray*}
1934\left \vert r_\mi \right \vert & \leq & \left \vert \circ \left( r_\mi + r_\lo \right) \right \vert \\
1935& \leq & 2 \cdot \left \vert r_\mi + r_\lo \right \vert \\
1936& \leq &
19372 \cdot \left \vert t_1 + a_\lo \cdot b_\lo + a_\hi \cdot b_\mi + a_\hi \cdot b_\lo + a_\lo \cdot b_\hi + a_\lo \cdot b_\mi + \delta_6 \right \vert \\
1938& \leq & 2 \cdot \left \vert a_\hi \cdot b_\hi \right \vert \cdot \\
1939& & \cdot \left(
19402^{-52} +
19412^{-\beta_o-\beta_u-53} +
19422^{-\beta_o} +
19432^{-\beta_o-\beta_u} +
19442^{-53} +
19452^{-\beta_o-53} +  \right. \\ & & \left.
19462^{-\beta_o-99} +
19472^{-\beta_o-\beta_u-99} +
19482^{-152} \right) \\
1949& \leq & \left \vert a_\hi \cdot b_\hi \right \vert
1950\cdot \left(
19512^{-50} +
19522^{-\beta_o-2} +
19532^{-\beta_o-\beta_u+2} \right)
1954\end{eqnarray*}
1955This implies that
1956\begin{eqnarray*}
1957\left \vert r_\mi \right \vert & \leq & 2 \cdot \left \vert r_\hi \right \vert \cdot \left(
19582^{-50} +
19592^{-\beta_o-2} +
19602^{-\beta_o-\beta_u+2} \right) \\
1961& \leq & \left \vert r_\hi \right \vert \cdot \left(
19622^{-49} +
19632^{-\beta_o-3} +
19642^{-\beta_o-\beta_u+3} \right)
1965\end{eqnarray*}
1966From which we can deduce
1967$$\left \vert r_\mi \right \vert \leq 2^{-\gamma} \cdot \left \vert r_\hi \right \vert$$
1968with
1969$$\gamma \geq \min \left( 48, \beta_o - 4, \beta_o -\beta_u -4 \right)$$
1970This result finishes the proof.\qed
1971\end{proof}
1972\section{Final rounding procedures}
1973The renormalisation sequence and all computational basic operators on triple-double numbers have been presented only
1974for one reason: allowing for implementing efficiently elementary functions in double precision
1975\cite{Defour-thesis, crlibmweb, DinDefLau2004LIP}. For obtaining this
1976goal we are still lacking an important basic brick: the final rounding of a triple-double number into a double precision
1977number. This rounding must be possible in each of the $4$ known rounding modes \cite{IEEE754}. In particular, we will
1978distinguish between the round-to-nearest sequence and the ones for the directed rounding modes.\\
1979Let us start this discussion by introducing some notations:\\
1980We will notate
1981\begin{itemize}
1982\item $\circ \left( x \right) \in \F$ the rounding to the nearest double precision number of a real number $x \in \R$,
1983\item $\vartriangle \left( x \right) \in \F$ the rounding towards $+\infty$ of a real $x \in \R$ into double precision,
1984\item $\triangledown \left( x \right) \in \F$ the rounding towards $-\infty$ of a real $x \in \R$ into double precision and
1985\item $\diamond \left( x \right) \in \F$ the rounding towards $0$ of a real number $x \in \R$ into a double pr\'ecision number.
1986\end{itemize}
1987Since the directed rounding modes behave all in a similar fashion we will make a slight abuse of our notations. An
1988unspecified directed rounding mode will be notated also $\diamond \left( x \right)$.
1989\begin{definition}[Correct rounding procedure] \label{defprocarrcorr} ~ \\
1990Let be {\bf A} a procedure taking a non-overlapping triple-double number $x_\hi + x_\mi + x_\lo$ as argument. This number be
1991such that
1992$x_\mi = \circ \left( x_\mi + x_\lo \right)$.
1993Let the procedure {\bf A} return a double precision number $x^\prime$.\\
1994So we will say that {\bf A} is a correct rounding procedure for round-to-nearest-ties-to-even mode iff
1995for all possible entries
1996$$x^\prime = \circ \left( x_\hi + x_\mi + x_\lo \right)$$
1997The same way {\bf A} is a correct rounding procedure for a directed rounding mode iff for all possible entries
1998$$x^\prime = \diamond \left( x_\hi + x_\mi + x_\lo \right)$$
1999\end{definition}
2000In the sequel we will present two algorithms for final rounding -- one for round-to-nearest mode, the other one for
2001the directed modes -- and we will prove their correctness with regard to definition \ref{defprocarrcorr}.
2002\subsection{Final rounding to the nearest even}
2003\begin{lemma}[Generation of half an $\mUlp$ or a quarter of an $\mUlp$] \label{genmiquartulp} ~\\
2004Let be $x$ a non-subnormal floating point number different from $\pm 0$, $\pm \infty$ and $\nan$ and such that $x^-$
2005is not a subnormal number. \\
2006Given the following instruction sequence:
2007\begin{center}
2008$t_1 \gets x^-$ \\
2009$t_2 \gets x \ominus t_1$ \\
2010$t_3 \gets t_2 \otimes \frac{1}{2}$
2011\end{center}
2012we know that
2013\begin{itemize}
2014\item if it exists a $k \in \Z$ such that $x=2^k$ exactly so
2015$$\left \vert t_3 \right \vert = \frac{1}{4} \cdot \mUlp \left( x \right)$$
2016\item if it does not exist any $k \in \Z$ such that $x=2^k$ exactly so
2017$$\left \vert t_3 \right \vert = \frac{1}{2} \cdot \mUlp \left( x \right)$$
2018\end{itemize}
2019\end{lemma}
2020\begin{proof} ~\\
2021Without loss of generality, we can suppose that $x$ is positive because the definition of $x^-$ and all floating
2022point operations are symmetrical with regard to the sign \cite{IEEE754} and because the egalities to be proven ignore it.
2023Additionally since the floating point multiplication by an integer power of $2$ is always exact, it suffices to
2024show that $t_2 = \frac{1}{2} \cdot \mUlp \left( x \right)$ if $x$ is exactly an integer power of $2$ and that
2025$t_2 = \mUlp\left( x \right)$ otherwise.\\
2026Let us begin by showing that we have the exact equation
2027$$t_2 = x - x^-$$
2028which means that the floating point substraction is exact. This is the case by Sterbenz' lemma \cite{Ste74} if
2029$$\frac{1}{2} \cdot x \leq x^- \leq 2 \cdot x$$
2030So let us show this inequality. \\
2031Since $x \not = 0$ and since it is not subnormal we know already that $x^- \not = 0$.
2032Additionally $x^- > 0$ because $x > 0$ and $x^-$ is its direct predecessor with regard to $<$.
2033Further by definition \ref{predsuccdef}, it is trivial to see that
2034$\forall y \in \F.\left( y^- \right)^+ = y = \left( y^+ \right)^-$.\\
2035Since $x$ is positive and since $x^-$ is therefore its predecessor with regard to $<$ we have
2036$$x^- < x < 2 \cdot x$$
2037Let us suppose now that
2038$$x^- < \frac{1}{2} \cdot x$$
2039Since $x$ is not subnormal and since it is positive, there exist $e \in \Z$ and  $m \in \N$ such that
2040$$x = 2^e \cdot m$$
2041with
2042$$2^{p-1} \leq m < 2^p$$
2043where $p \geq 2$ is the format's precision; in particular, for double precision, $p=53$.\\
2044Given that $x^-$ is not subnormal neither and positive, too, it is the predecessor of $x$ and verifies
2045$$x^- = \left \lbrace \begin{array}{lll} 2^e \cdot \left(m - 1 \right) & \mbox{ if } & m-1 \geq 2^{p-1} \\
2046                                             2^{e-1} \cdot \left( 2^p - 1 \right) & \mbox{ otherwise} & \end{array} \right.$$
2047So two cases must be treated separately:\\~\\
2048{\bf 1st case: $x^- = 2^e \cdot  \left( m -1 \right)$ } \\ ~ \\
2049We get here with the hypotheses supposed
2050\begin{eqnarray*}
2051x^- & < & \frac{1}{2} \cdot x \\
20522^e \cdot \left( m - 1 \right) & < & \frac{1}{2} \cdot 2^e \cdot m \\
2053m-1 & < & \frac{1}{2} \cdot m \\
2054m & < & 2
2055\end{eqnarray*}
2056In contrast $m \geq 2^{p-1}$ and $p\geq2$; so we have contradiction in this case. \\ ~ \\
2057{\bf 2nd case: $x^- = 2^{e-1} \cdot  \left( 2^p -1 \right)$ } \\ ~ \\
2058We can check
2059\begin{eqnarray*}
2060x^- & < & \frac{1}{2} \cdot x \\
20612^{e-1} \cdot \left( 2^{p-1} - 1 \right) & < & \frac{1}{2} \cdot 2^e \cdot m \\
20622^{e-1} \cdot \left( 2^{p-1} - 1 \right) & < & 2^{e-1} \cdot m \\
20632^p - 1 < m
2064\end{eqnarray*}
2065In contrast $m<2^p$, thus $2^p - 1 < m < 2^p$.
2066This is a contradiction because the inequalities are strict and $m \in \N$. \\ ~ \\
2067So Sterbenz' lemma \cite{Ste74} can be applied and we get the exact equation
2068$$t_2 = x - x^-$$
2069It is now important to see that
2070$$x^+ = \left \lbrace \begin{array}{lll} 2^e \cdot \left(m + 1 \right) & \mbox{ if } & m+1 < 2^p \\
2071                                             2^{e+1} \cdot 2^{p-1} & \mbox{ otherwise} & \end{array} \right.$$
2072Further, without loss of generality, we can suppose that $x^+ \not = + \infty$ and that therefore
2073$$\mUlp \left( x \right) = x^+ - x$$
2074If ever we could not suppose this, it would suffice to apply definition \ref{defulp} of the
2075$\mUlp$ function which would only change the exponent $e$ by $1$ in the sequel.\\
2076So at this stage of the proof, two different cases are to be treated:
2077$x$ is or is not exactly an integer power of $2$. \\ ~ \\
2078{\bf 1st case: $x$ is not exactly an integer power of $2$ } \\ ~ \\
2079So we get $x=2^e \cdot m$ with $2^{p-1} < m < 2^p$ from which we deduce that $m-1 \geq 2^{p-1}$ and that, finally,
2080$$x^- = 2^e \cdot \left(m - 1 \right)$$
2081So still two sub-cases present themselves: \\ ~ \\
2082{\bf case a): $x^+ = 2^e \cdot \left( m + 1 \right)$} \\ ~ \\
2083We can check that
2084\begin{eqnarray*}
2085\mUlp \left( x \right) & = & x^+ - x \\
2086& = & 2^e \cdot \left( m + 1 \right) - 2^e \cdot m \\
2087& = & 2^e \cdot \left(m + 1 - m \right) \\
2088& = & 2^e
2089\end{eqnarray*}
2090and
2091\begin{eqnarray*}
2092t_2 & = & x - x^- \\
2093& = & 2^e \cdot m - 2^e \cdot \left( m - 1 \right) \\
2094& = & 2^e \cdot \left( m - m + 1 \right) \\
2095& = & 2^e
2096\end{eqnarray*}
2097So we know that
2098$$t_2 = \mUlp \left( x \right)$$ ~ \\
2099{\bf case b): $x^+ = 2^e \cdot \left( m + 1 \right)$} \\ ~ \\
2100So in order to get $x^+$ being equal to $2^e \cdot \left( m + 1 \right)$, we must have $m+1 \geq 2^p$. \\
2101In contrast we can show that $m+1 \leq 2^p$ as follows: \\
2102Let us suppose that $m+1 > 2^p$. Since $m < 2^p$ because $x$ is not subnormal we get
2103$$2^p - 1 < m < 2^p$$
2104In contrast, the inequalities are strict and $m \in \N$, thus contradiction. \\
2105We therefore know that
2106$$m=2^p - 1$$
2107So we get
2108\begin{eqnarray*}
2109\mUlp \left( x \right) & = & x^+ - x \\
2110& = & 2^{e+1} \cdot 2^{p-1} - 2^e \cdot \left( 2^p - 1 \right) \\
2111& = & 2^e \cdot 2^p - 2^e \cdot 2^p + 2^e \\
2112& = & 2^e
2113\end{eqnarray*}
2114and
2115\begin{eqnarray*}
2116t_2 & = & x - x^- \\
2117& = & 2^e \cdot \left( 2^p - 1 \right) - 2^e \cdot \left( 2^p - 2 \right) \\
2118& = & 2^e \cdot 2^p - 2^e - 2^e \cdot 2^p + 2 \cdot 2^e \\
2119& = & 2^e
2120\end{eqnarray*}
2121Thus we have still
2122$$t_2 = \mUlp \left( x \right)$$ ~ \\
2123{\bf 2nd case: $x$ is exactly an integer power of $2$ } \\ ~ \\
2124So in this case we verify that $$x=2^e \cdot 2^{p-1}$$ and therefore $m=2^{p-1}$. \\
2125In consequence, $$x^+ = 2^e \cdot \left(2^{p-1} + 1 \right)$$ because we got
2126$2^{p-1} + 1 < 2^p$ since $p \geq 2$. \\
2127The same way $$x^- = 2^{e-1} \cdot \left(2^p - 1 \right)$$ because, trivially, $2^{p-1} - 1 < 2^{p-1}$.\\
2128So we get
2129\begin{eqnarray*}
2130\mUlp \left( x \right) & = & x^+ - x \\
2131& = & 2^e \cdot \left( 2^{p-1} + 1 \right) - 2^e \cdot 2^{p-1} \\
2132& = & 2^e \cdot 2^{p-1} + 2^e - 2^e \cdot 2^{p-1} \\
2133& = & 2^e
2134\end{eqnarray*}
2135and
2136\begin{eqnarray*}
2137t_2 & = & x - x^- \\
2138& = & 2^e \cdot 2^{p-1} - 2^{e-1} \cdot \left( 2^p - 1 \right) \\
2139& = & 2^e \cdot 2^{p-1} - 2^{e-1} \cdot 2^p + 2^{e-1} \\
2140& = & 2^{e-1} \\
2141& = & \frac{1}{2} \cdot 2^e
2142\end{eqnarray*}
2143Thus we can check that
2144$$t_2 = \frac{1}{2} \cdot \mUlp \left( x \right)$$ \qed
2145\end{proof}
2146\begin{lemma}[Generation of half an $\mUlp$] \label{genmiulp} ~\\
2147Let be $x$ a non-subnormal floating point number different from $\pm 0$, $\pm\infty$ and $\nan$.\\
2148Let be the following instruction sequence:
2149\begin{center}
2150$t_1 \gets x^+$ \\
2151$t_2 \gets t_1 \ominus x$ \\
2152$t_3 \gets t_2 \otimes \frac{1}{2}$
2153\end{center}
2154So the following holds
2155$$\left \vert t_3 \right \vert = \frac{1}{2} \cdot \mUlp \left( x \right)$$
2156and one knows that
2157\begin{center}
2158$x > 0$ iff $t_3 > 0$
2159\end{center}
2160\end{lemma}
2161\begin{proof} ~ \\
2162In the beginning we will show the first equation; the equivalence of the signs will be shown below.
2163So, without loss of generality, we can suppose that $x$ is positive because the definition of $x^+$ and all
2164floating point operations are symmetrical with regard to the sign \cite{IEEE754}
2165and because the equation to be shown ignorates it.
2166Further since the floating point multiplication by an integer power of $2$ is always exact, it suffices to show that
2167$t_2 = \frac{1}{2} \cdot \mUlp \left( x \right)$.\\
2168Let us still start the proof by showing that the substraction
2169$$t_2 \gets t_1 \ominus x$$
2170is exact by Sterbenz' lemma \cite{Ste74}. We must therefore show that
2171$$\frac{1}{2} \cdot x \leq x^+ \leq 2 \cdot x$$
2172Since $x$ is positive and since $x^+$ is its direct successor in the ordered set of the floating point numbers, we know
2173already that $x < x^+$.
2174So trivially, we get $$\frac{1}{2} \cdot x < x < x^+$$
2175Let us suppose now that
2176$$x^+ > 2 \cdot x$$
2177Since $x$ is not subnormal and since it is positive, there exist $e \in \Z$ and $m \in \N$ such that
2178$$x = 2^e \cdot m$$
2179with
2180$$2^{p-1} \leq m < 2^p$$
2181where $p\geq 2$ is the precision of the format.\\
2182Further we know that
2183$$x^+ = \left \lbrace \begin{array}{lll} 2^e \cdot \left(m + 1 \right) & \mbox{ if } & m+1 < 2^p \\
2184                                         2^{e+1} \cdot 2^{p-1} & \mbox{ otherwise} & \end{array} \right.$$
2185So two different cases show up: \\ ~ \\
2186{\bf 1st case: $x^+ = 2^e \cdot \left( m + 1 \right)$} \\ ~ \\
2187We have
2188\begin{eqnarray*}
2189x^+ & > & 2 \cdot x \\
21902^e \cdot \left( m + 1 \right) & > & 2 \cdot 2^e \cdot m \\
2191m+1 & > & 2 \cdot m \\
21921 & > & m
2193\end{eqnarray*}
2194In contrast, $m \geq 2^{p-1}$ and $p \geq 2$, thus contradiction. \\ ~ \\
2195{\bf 2nd case: $x^+ = 2^{e+1} \cdot 2^{p-1}$} \\ ~ \\
2196So in this case, we have $m+1\geq 2^p$ and therefore $m=2^p - 1$ because $m \leq 2^p - 1$ holds
2197since $x$ is not subnormal.\\
2198We get thus
2199\begin{eqnarray*}
2200x^+ & > & 2 \cdot x \\
22012^{e+1} \cdot 2^{p-1} & > & 2 \cdot 2^e \cdot \left( 2^p - 1 \right) \\
22022^e \cdot 2^p & > & 2 \cdot 2^e \cdot 2^p - 2 \cdot 2^e \\
22032^p & > & 2 \cdot 2^p - 2 \\
22042 > 2^p
2205\end{eqnarray*}
2206In contrast $p\geq2$ which is contradictory.\\
2207So we can apply Sterbenz' lemma \cite{Ste74} and we get immediately that
2208$$t_2 = x^+ - x = \mUlp \left( x \right)$$ by the definition of the $\mUlp$ function \\
2209Let us show now that
2210$$x > 0 \mbox{ iff } t_3 > 0$$
2211Let us suppose that $x$ is positive. In consequence $x^+$ is its successor with regard to $<$ and we get
2212$$x^+ - x > 0$$ which means that
2213\begin{eqnarray*}
2214t_2 & = & x^+ \ominus x \\
2215& = & \circ \left( x^+ - x \right) \\
2216& > & 0
2217\end{eqnarray*}
2218because the rounding function is monotonic for positive numbers.\\
2219In contrast, if $x$ is negative $x^+$ is its predecessor with regard to $<$ and we get thus $x^+ - x < 0$. \\
2220We conclude in this case in the same way.\qed
2221\end{proof}
2222\begin{lemma}[Signs of the generated values] \label{gensigne} ~\\
2223Let be $x \in \F$ a non-subnormal floating point number different from $0$.\\
2224Given the following instruction sequence
2225\begin{center}
2226$t_1 \gets x^-$ \\
2227$t_2 \gets x \ominus t_1$ \\
2228$t_3 \gets t_2 \otimes \frac{1}{2}$ \\
2229$t_4 \gets x^+$ \\
2230$t_5 \gets t_4 \ominus x$ \\
2231$t_6 \gets t_5 \otimes \frac{1}{2}$
2232\end{center}
2233the values $t_3$ and $t_6$ have the same sign.
2234\end{lemma}
2235\begin{proof} ~\\
2236It is clear that it suffices to show that $t_2$ and $t_5$ have the same sign. Because of definition \ref{predsuccdef}
2237of $x^+$ and $x^-$, we are obliged to treat two different cases which depend on whether $x$ is positive or not.\\ ~ \\
2238{\bf 1st case: $x>0$} \\ ~ \\
2239So $x^+$ is the successor of $x$ with regard to the order $<$ on the floating point numbers and $x^-$
2240is its predecessor. Formally we have
2241$$x^- < x < x^+$$
2242Thus
2243\begin{eqnarray*}
2244x - x^- & > & 0 \\
2245x^+ - x & > & 0
2246\end{eqnarray*}
2247Due to the monotony of the rounding function, we obtain
2248\begin{eqnarray*}
2249\circ \left( x - x^- \right) & > & \circ \left( 0 \right) \\
2250\circ \left( x^+ - x \right) & > & \circ \left( 0 \right)
2251\end{eqnarray*}
2252and thus, since $0$ is exactly representable,
2253\begin{eqnarray*}
2254x \ominus x^- & > & 0 \\
2255x^+ \ominus x & > & 0
2256\end{eqnarray*}
2257which is the fact to be shown. \\ ~ \\
2258{\bf 2nd case: $x<0$} \\ ~ \\
2259We get in this case that $x^+ < x < x^-$ and we finish the proof in a complete analogous way to the 1st case.\qed
2260\end{proof}
2261In the sequel, we will use the sign function $\sgn\left( x \right)$ which we define as follows:
2262$$\forall x \in \R\mbox{ . }\sgn\left( x \right) = \left \lbrace \begin{array}{cl} -1 & \mbox{ if } x < 0 \\
2263                                                                           0 & \mbox{ if } x = 0 \\
2264                                                                           1 & \mbox{ otherwise} \end{array} \right.$$
2265\begin{lemma}[Equivalence between a $\xor$ and a floating point multiplication] \label{equivxormult} ~ \\
2266Let be $x, y \in \F$ two floating point numbers such that $x \not = 0$, $y \not = 0$. \\
2267So, \vspace{-5mm}
2268\begin{center}
2269$$x \otimes y \geq 0$$
2270implies
2271$$x > 0 \xor y > 0$$
2272\end{center}
2273\end{lemma}
2274\begin{proof} ~ \\
2275Clearly $x \otimes y \geq 0$ implies $\circ \left( x \cdot y \right) \geq 0$. By monotony of the rounding function, this yields to
2276$x \cdot y \geq 0$. Trivially one sees that this means that $x \geq 0 \xor y \geq 0$. Since the equations are not possible
2277by hypothesis, we can conclude.\qed
2278\end{proof}
2279\begin{lemma}[Round-to-nearest-ties-to-even of the lower significance parts] \label{arrpairfaible} ~ \\
2280Let be $x_\mi$ and $x_\lo$ two non-subnormal floating point numbers such that
2281$\exists e \in \Z \mbox{ . } 2^e = t$ such that $x_\mi = t^-$
2282and that $x_\lo = \frac{1}{4} \cdot \mUlp\left( t \right)$. \\
2283So,
2284$$x_\mi \not = \circ \left( x_\mi + x_\lo \right)$$
2285Similar, let be $x_\mi$ and $x_\lo$ two non-subnormal floating point numbers such that
2286$\exists e \in \Z \mbox{ . } 2^e = t$ such that $x_\mi = t^+$
2287and that $x_\lo = \frac{1}{2} \cdot \mUlp\left( t \right)$. \\
2288So,
2289$$x_\mi \not = \circ \left( x_\mi - x_\lo \right)$$
2290\end{lemma}
2291\begin{proof} ~\\
2292In both cases $t$ is representable as a floating point number because $x_\mi$ is not subnormal.
2293Since $t$ is an integer power of $2$, the significand of $t$ is even.
2294Therefore the significand of $x_\mi$ is odd in both cases because $x_\mi$ is either the direct predecessor or the direct
2295successor of $t$. \\
2296Let us show now that $\left \vert x_\lo \right \vert = \frac{1}{2} \cdot \mUlp\left(x_\mi \right)$.
2297If $x_\mi = t^-$ then we can deduce
2298\begin{eqnarray*}
2299\frac{1}{2} \cdot \mUlp\left( x_\mi \right) & = & \frac{1}{2} \cdot \left( x_\mi^+ - x_\mi \right) \\
2300& = & \frac{1}{2} \cdot \left( t - t^- \right) \\
2301& = & - \frac{1}{4} \cdot \left( t^+ - t \right) \\
2302& = & - \frac{1}{4} \cdot \mUlp\left( t \right) \\
2303& = & - x_\lo
2304\end{eqnarray*}
2305using amongst others lemma \ref{poweroftwo}.
2306If $x_\mi = t^+$ then we know that $x_\mi$ is not an integer power of $2$ because $t$ is one and we are supposing that the
2307format's precision $p$ is greater than $2$ bits. So it exists $e \in \Z$ and $m = 2^p$ such that $t = 2^e \cdot m$
2308\begin{eqnarray*}
2309\frac{1}{2} \cdot \mUlp\left( x_\mi \right) & = & \frac{1}{2} \cdot \left( x_\mi^+ - x_\mi \right) \\
2310& = & \frac{1}{2} \cdot \left( 2^e \cdot \left( m + 2 \right) - 2^e \cdot \left( m + 1 \right) \right) \\
2311& = & \frac{1}{2} \cdot \left( 2^e \cdot \left( m + 1 \right) - 2^e \cdot m \right) \\
2312& = & \frac{1}{2} \cdot \mUlp\left( t \right) \\
2313& = & x_\lo
2314\end{eqnarray*}
2315So, in both cases, $x_\mi + x_\lo$ is located exactly at the middle of two floating point numbers that can be expressed
2316with the exponent of $x_\mi$ or its successor and its predecessor.
2317Since $x_\mi$ has an odd significand the rounding with done away from it.\qed
2318\end{proof}
2319\begin{algorithm}[Final rounding to the nearest (even)] \label{algarrpres} ~ \\
2320{\bf In:} a triple-double number $x_\hi + x_\mi + x_\lo$ \\
2321{\bf Out:} a double precision number $x^\prime$ returned by the algorithm \\
2322{\bf Preconditions on the arguments:}
2323\begin{itemize}
2324\item $x_\hi$ and $x_\mi$ as well as $x_\mi$ and $x_\lo$ do not overlap
2325\item $x_\mi = \circ \left( x_\mi + x_\lo \right)$
2326\item $x_\hi \not = 0$, $x_\mi \not = 0$ and $x_\lo \not = 0$
2327\item $\circ \left( x_\hi + x_\mi \right) \not \in \left \lbrace x_\hi^-, x_\hi, x_\hi^+ \right \rbrace \Rightarrow
2328\left \vert \left( x_\hi + x_\mi \right) - \circ\left( x_\hi + x_\mi \right) \right \vert \not =
2329\frac{1}{2} \cdot \mUlp\left( \circ \left( x_\hi + x_\mi \right) \right)$
2330\end{itemize}
2331{\bf Algorithm:} \\
2332\begin{center}
2333\begin{minipage}[b]{80mm}
2334$t_1 \gets x_\hi^-$ \\
2335$t_2 \gets x_\hi \ominus t_1$ \\
2336$t_3 \gets t_2 \otimes \frac{1}{2}$ \\
2337$t_4 \gets x_\hi^+$ \\
2338$t_5 \gets t_4 \ominus x_\hi$ \\
2339$t_6 \gets t_5 \otimes \frac{1}{2}$
2340\\ ~ \\
2341{\bf if} $\left( x_\mi \not = -t_3 \right)$ {\bf and} $\left( x_\mi \not = t_6 \right)$ {\bf then}
2342\vspace{-2.4mm}
2343\begin{center}
2344\begin{minipage}[b]{70mm}
2345\vspace{-2.4mm}
2346{\bf return } $\left( x_\hi \oplus x_\mi \right)$
2347\end{minipage}
2348\end{center}
2349\vspace{-2.4mm}
2350{\bf else}
2351\vspace{-2.4mm}
2352\begin{center}
2353\begin{minipage}[b]{70mm}
2354{\bf if} $\left( x_\mi \otimes x_\lo > 0.0 \right)$ {\bf then}
2355\vspace{-2.4mm}
2356\begin{center}
2357\begin{minipage}[b]{60mm}
2358{\bf if} $\left( x_\hi \otimes x_\lo > 0.0 \right)$ {\bf then}
2359\vspace{-2.4mm}
2360\begin{center}
2361\begin{minipage}[b]{50mm}
2362\vspace{-2.4mm}
2363{\bf return } $x_\hi^+ $
2364\end{minipage}
2365\end{center}
2366\vspace{-2.4mm}
2367{\bf else}
2368\vspace{-2.4mm}
2369\begin{center}
2370\begin{minipage}[b]{50mm}
2371\vspace{-2.4mm}
2372{\bf return } $x_\hi^- $
2373\end{minipage}
2374\end{center}
2375\vspace{-2.4mm}
2376{\bf end if}
2377\end{minipage}
2378\end{center}
2379\vspace{-2.4mm}
2380{\bf else}
2381\vspace{-2.4mm}
2382\begin{center}
2383\begin{minipage}[b]{60mm}
2384\vspace{-2.4mm}
2385{\bf return } $x_\hi $
2386\end{minipage}
2387\end{center}
2388\vspace{-2.4mm}
2389{\bf end if}
2390\end{minipage}
2391\end{center}
2392\vspace{-2.4mm}
2393{\bf end if}
2394\end{minipage}
2395\end{center}
2396\end{algorithm}
2397\begin{theorem}[Correctness of the final rounding procedure \ref{algarrpres}]\label{corralgpluspres} ~\\
2398Let be {\bf A} the algorithm \ref{algarrpres} said \ouvguill Final rounding to the nearest (even)\fermguill.
2399Let be $x_\hi + x_\mi + x_\lo$ triple-double number for which the preconditions of algorithm {\bf A} hold.
2400Let us notate $x^\prime$ the double precision number returned by the procedure. \\
2401So
2402$$x^\prime = \circ \left( x_\hi + x_\mi + x_\lo \right)$$
2403i.e. {\bf A} is a correct rounding procedure for round-to-nearest-ties-to-even mode.
2404\end{theorem}
2405\begin{proof} ~ \\
2406During this proof we will proceed as follows: one easily sees that the presented procedure can only return four
2407different results which are $x_\hi \oplus x_\mi$, $x_\hi$, $x_\hi^+$ and $x_\hi^-$.
2408The choices made by the branches of the algorithm imply for each of this results additional hypotheses on the
2409arguments' values. It will therefore suffice to show for each of this four choices that the rounding of the
2410arguments is equal to the result returned under this hypotheses. In contrast, the one that can be easily
2411deduced from the tests on the branches, which use a floating point multiplication in fact, are not particularly
2412adapted to what is needed in the proof. Using amongst others lemma \ref{equivxormult}, one sees that
2413$9$ different simply analysable cases are possible out of which one is a special one and $8$ have a very regular form:
2414\begin{enumerate}
2415\item If the first branch is taken, we know that
2416$$x_\mi \not = \sgn\left( x_\hi \right) \cdot \frac{1}{2} \cdot \mUlp \left( x_\hi \right)$$
2417and that
2418$$x_\mi \not = - \sgn\left( x_\hi \right) \cdot \left \lbrace
2419\begin{array}{ll} \frac{1}{4} \cdot \mUlp \left( x_\hi \right) & \mbox{ if } \exists e \in \Z \mbox{ . } 2^e = x_\hi \\
2420                  \frac{1}{2} \cdot \mUlp \left( x_\hi \right) & \mbox{ otherwise} \end{array} \right.$$
2421as per lemmas \ref{genmiquartulp}, \ref{genmiulp} and \ref{gensigne}.
2422In this case $x_\hi \oplus x_\mi$ will be returned.
2423\item If the first branch is not taken, we know already very well the absolute value of $x_\mi$:
2424we can therefore suppose that
2425$$\left \vert x_\mi \right \vert = \left \lbrace
2426\begin{array}{ll} \frac{1}{4} \cdot \mUlp \left( x_\hi \right) & \mbox{ if } \exists e \in \Z \mbox{ . } 2^e = x_\hi \\
2427                  \frac{1}{2} \cdot \mUlp \left( x_\hi \right) & \mbox{ otherwise} \end{array} \right.$$
2428It is thus natural that $x_\mi$ does not play any role in the following computations of the value to be returned but by its
2429sign.
2430Using \ref{equivxormult} we know that the two tests that follow are equivalent to
2431{{\bf if} $x_\mi > 0 \xor x_\lo > 0$} and to {{\bf if} $x_\hi > 0 \xor x_\lo > 0$}.
2432It is easy to check that the values returned depending on the signs of
2433$x_\hi$, $x_\mi$ and $x_\lo$ obey to this scheme:
2434\begin{center}
2435\begin{tabular}{l|ccc|cc|c|c}
2436Case & $x_\hi$ & $x_\mi$ & $x_\lo$ & $x_\mi \xor x_\lo$ & $x_\hi \xor x_\lo$ &
2437Return val. $x^\prime$ & Interpreted val. $x^\prime$ \\
2438\hline
2439a.) & + & + & + & + & + & $x_\hi^+$ & $\succ\left( x_\hi \right)$ \\
2440b.) & + & + & - & - & - & $x_\hi$ & $x_\hi$ \\
2441c.) & + & - & + & - & + & $x_\hi$ & $x_\hi$ \\
2442d.) & + & - & - & + & - & $x_\hi^-$ & $\pred\left( x_\hi \right)$ \\
2443e.) & - & + & + & + & - & $x_\hi^-$ & $\succ\left( x_\hi \right)$ \\
2444f.) & - & + & - & - & + & $x_\hi$ & $x_\hi$ \\
2445g.) & - & - & + & - & - & $x_\hi$ & $x_\hi$ \\
2446h.) & - & - & - & + & + & $x_\hi^+$ & $\pred\left( x_\hi \right)$
2447\end{tabular}
2448\end{center}
2449We see now that the returned value $x^\prime$ expressed as $x_\hi$, $\succ\left(x_\hi\right)$ or $\pred\left(x_\hi\right)$ in
2450cases a.) through d.) are equivalent to cases h.) through e.).
2451We will consider them thus equivalently; of course, doing so, we will not any longer be able to suppose anything
2452concerning the magnitude and the sign of $x_\hi$.
2453\end{enumerate}
2454Let us start the proof by showing the correctness of the first case.
2455Since $x_\hi$ and $x_\mi$ do not overlap by hypothesis, we know by definition \ref{defoverlap} that
2456$$\left \vert x_\mi \right \vert < \mUlp\left( x_\hi \right)$$
2457So we can notate the following
2458$$x_\mi \in I^\prime_1 \cup I^\prime_2 \cup I^\prime_3 \cup I^\prime_4 \cup I^\prime_5 \cup I^\prime_6$$
2459with
2460\begin{eqnarray*}
2461I^\prime_1 & = & \left] - \mUlp\left( x_\hi \right) ; -\frac{3}{4} \cdot \mUlp\left(x_\hi \right) \right] \\
2462I^\prime_2 & = & \left] -\frac{3}{4} \cdot \mUlp\left(x_\hi \right) ;
2463- \frac{1}{2} \cdot \mUlp\left(x_\hi \right) \right[ \\
2464I^\prime_3 & = & \left[ - \frac{1}{2} \cdot \mUlp\left(x_\hi \right); -\tau \right[ \\
2465I^\prime_4 & = & \left] -\tau ; 0 \right] \\
2466I^\prime_5 & = & \left[ 0; \frac{1}{2} \cdot \mUlp\left(x_\hi\right) \right[ \\
2467I^\prime_6 & = & \left ] \frac{1}{2} \cdot \mUlp\left( x_\hi \right) ; \mUlp\left( x_\hi \right) \right [
2468\end{eqnarray*}
2469where
2470$$\tau = \left \lbrace
2471\begin{array}{ll} \frac{1}{4} \cdot \mUlp \left( x_\hi \right) & \mbox{ if } \exists e \in \Z \mbox{ . } 2^e = x_\hi \\
2472                  \frac{1}{2} \cdot \mUlp \left( x_\hi \right) & \mbox{ otherwise} \end{array} \right.$$
2473This is equivalent to claiming
2474$$x_\mi \in I_1 \cup I_2 \cup I_3 \cup I_4 \cup I_5 \cup I_6$$
2475where
2476\begin{eqnarray*}
2477I_1 & = & \left [ \left( -\mUlp\left( x_\hi \right) \right)^- ;
2478\left( -\frac{3}{4} \cdot \mUlp\left(x_\hi \right) \right)^+ \right] \\
2479I_2 & = & \left [ \left( \frac{3}{4} \cdot \mUlp\left( x_\hi \right) \right)^- ;
2480\left(- \frac{1}{2} \cdot \mUlp\left(x_\hi \right)\right)^+ \right] \\
2481I_3 & = & \left [ \left( -\frac{1}{2} \cdot \mUlp\left( x_\hi \right) \right)^- ; \left( -\tau \right)^+ \right] \\
2482I_4 & = & \left [ \left( -\tau \right)^- ; 0 \right] \\
2483I_5 & = & \left [ 0 ; \left( \frac{1}{2} \cdot \mUlp\left(x_\hi\right) \right)^- \right] \\
2484I_6 & = & \left [ \left(\frac{1}{2} \cdot \mUlp\left( x_\hi \right) \right)^+ ; \left( \mUlp\left( x_\hi \right) \right)^- \right ]
2485\end{eqnarray*}
2486because $x_\mi$ is a floating point number and because all bounds of the intervals are floating point numbers, too. So
2487we can express their predecessors and successors by $z^+$ and $z^-$. Thus $\forall i=1,\dots,6 \mbox{ . } I^\prime_i = I_i$.
2488It is clear that the set of floating point numbers $I_3$ is empty if
2489$\tau = \frac{1}{2} \cdot \mUlp\left( x_\hi \right)$.\\
2490Further we know that $x_\mi$ and $x_\lo$ do not overlap and that $x_\mi = \circ \left( x_\mi + x_\lo \right)$ by hypothesis.
2491This means that
2492$$\left \vert x_\lo \right \vert \leq \frac{1}{2} \cdot \mUlp \left( x_\mi \right) \leq \frac{1}{2} \cdot \mUlp\left( \mUlp \left( x_\hi \right) \right)$$
2493and we can write
2494$$x_\mi + x_\lo \in \left( J_1 \cup J_2 \cup J_3 \cup J_4 \cup J_5 \cup J_6\right) \backslash U$$
2495with
2496\begin{eqnarray*}
2497J_1 & = & \left [ \left( -\mUlp\left( x_\hi \right) \right)^-
2498- \frac{1}{2} \cdot \mUlp\left( \mUlp \left( x_\hi \right) \right) ;
2499\left( - \frac{3}{4} \cdot \mUlp\left( x_\hi \right) \right)^+
2500+ \frac{1}{2} \cdot \mUlp\left( \mUlp\left( x_\hi \right) \right) \right] \\
2501J_2 & = & \left[ \left( - \frac{3}{4} \cdot \mUlp\left( x_\hi \right) \right)^-
2502- \frac{1}{2} \cdot \mUlp \left( \mUlp\left( x_\hi \right) \right) ;
2503\left(-\frac{1}{2} \cdot \mUlp\left(x_\hi \right)\right)^+
2504+ \frac{1}{2} \cdot \mUlp\left( \mUlp \left( x_\hi \right) \right) \right] \\
2505J_3 & = & \left [ \left(- \frac{1}{2} \cdot \mUlp\left(x_\hi \right)\right)^-
2506- \frac{1}{2} \cdot \mUlp\left( \xi_1 \right) ;
2507\left( -\tau \right)^+ + \frac{1}{2} \cdot \mUlp\left( \xi_1 \right) \right] \\
2508J_4 & = & \left [ \left( -\tau \right)^- - \frac{1}{2} \cdot \mUlp\left( \xi_2 \right) ; 0 \right] \\
2509J_5 & = & \left [ 0;
2510\left( \frac{1}{2} \cdot \mUlp\left(x_\hi\right) \right)^- + \frac{1}{2} \cdot \mUlp\left( \xi_3 \right) \right] \\
2511J_6 & = & \left [ \left(\frac{1}{2} \cdot \mUlp\left( x_\hi \right) \right)^+
2512- \frac{1}{2} \cdot \mUlp\left( \mUlp \left( x_\hi \right) \right);
2513\left( \mUlp\left( x_\hi \right) \right)^- + \frac{1}{2} \cdot \mUlp\left( \mUlp \left( x_\hi \right) \right) \right ]
2514\end{eqnarray*}
2515where
2516\begin{eqnarray*}
2517\xi_1 & = & \frac{1}{2} \cdot \mUlp\left(x_\hi\right) \in I_3 \\
2518\xi_2 & = & \tau \in I_4 \\
2519\xi_3 & = & \frac{1}{2} \cdot \mUlp\left(x_\hi\right) \in I_5
2520\end{eqnarray*}
2521and where $U$ is the set of the impossible cases for $x_\mi + x_\lo$. The word \ouvguill impossible\fermguill~ refers here
2522to the facts caused by the property that $x_\mi = \circ \left( x_\mi + x_\lo \right)$. \\
2523Let us still remark that the intervals $J_3$, $J_4$ and $J_5$ are well defined as per lemma \ref{ulpmonoton}
2524and that it is important to see that it does not suffice to estimate their bounds by the less exact inequality
2525that follows:
2526$$\mUlp \left( x_\mi \right) \leq \mUlp\left( \mUlp \left( x_\hi \right) \right)$$
2527which would mean that
2528$$\xi_i = \mUlp\left( x_\hi \right)$$
2529Since the images of the $\mUlp$ function are always integer powers of $2$, the difference of their predecessors and
2530themselves can be as small as half an $\mUlp$ of an $\mUlp$ of $x_\hi$ which would be a too inexact estimate. \\
2531Let us continue now with the simplification of the bounds of the intervals $J_i$. The purpose of this
2532will be showing that $x_\mi + x_\lo$ are always intervals such that one can decide the rounding
2533$\circ \left( x_\hi + \left( x_\mi + x_\lo \right) \right)$
2534without using the rule of even rounding. Let us remark already that we know that $\forall i=1,\dots,6 \mbox{ . } I_i \subseteq J_i$.\\
2535Since $\mUlp\left( x_\hi \right)$ is a non-subnormal floating point number that is positive and equal to an integer power
2536of $2$, we get using lemmas \ref{commut} and \ref{poweroftwo} that
2537\begin{eqnarray*}
2538\left( - \mUlp\left( x_\hi \right)  \right)^- - \frac{1}{2} \cdot \mUlp\left(  \mUlp\left( x_\hi \right)  \right) & = &
2539- \mUlp\left( x_\hi \right)^- - \frac{1}{2} \cdot \left(  \mUlp\left( x_\hi \right)^+ -  \mUlp\left( x_\hi \right)  \right) \\
2540& = & - \mUlp\left( x_\hi \right)  + \left(  \mUlp\left( x_\hi \right)  - \mUlp\left( x_\hi \right)^- \right) \\ & & -
2541\frac{1}{2} \cdot \left(  \mUlp\left( x_\hi \right)^+ -  \mUlp\left( x_\hi \right)  \right) \\
2542& = & - \mUlp\left( x_\hi \right)
2543\end{eqnarray*}
2544and similarly
2545\begin{eqnarray*}
2546 \mUlp\left( x_\hi \right)^- + \frac{1}{2} \cdot \mUlp\left(  \mUlp\left( x_\hi \right)  \right) & = &
2547\mUlp\left( x_\hi \right)^- + \frac{1}{2} \cdot \left(  \mUlp\left( x_\hi \right)^+ -  \mUlp\left( x_\hi \right)  \right) \\
2548& = &  \mUlp\left( x_\hi \right)^- + \left(  \mUlp\left( x_\hi \right)  -  \mUlp\left( x_\hi \right)^- \right) \\
2549& = &  \mUlp\left( x_\hi \right)
2550\end{eqnarray*}
2551Further, still analogously to the previous cases and using lemma \ref{multhalf},
2552\begin{eqnarray*}
2553\left( \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)^- + \frac{1}{2} \cdot \mUlp\left( \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)
2554& = &
2555\frac{1}{2} \cdot  \mUlp\left( x_\hi \right)^- + \frac{1}{4} \mUlp\left(  \mUlp\left( x_\hi \right)  \right) \\
2556& = & \frac{1}{2} \cdot \left(  \mUlp\left( x_\hi \right)^- + \frac{1}{2} \cdot \left(  \mUlp\left( x_\hi \right)^+
2557-  \mUlp\left( x_\hi \right)  \right) \right) \\
2558& = & \frac{1}{2} \cdot \left(  \mUlp\left( x_\hi \right)^- +  \mUlp\left( x_\hi \right)  -  \mUlp\left( x_\hi \right)^- \right) \\
2559& = & \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)
2560\end{eqnarray*}
2561and
2562\begin{eqnarray*}
2563\left( \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)^+ - \frac{1}{2} \cdot \mUlp\left(  \mUlp\left( x_\hi \right)  \right) & = &
2564\frac{1}{2} \cdot  \mUlp\left( x_\hi \right)^+ - \frac{1}{2} \cdot \left(  \mUlp\left( x_\hi \right)^+ -  \mUlp\left( x_\hi \right)  \right) \\
2565& = & \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)
2566\end{eqnarray*}
2567Then
2568\begin{eqnarray*}
2569\left( - \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)^- - \frac{1}{2} \cdot \mUlp\left( \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)
2570& = & - \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)^- - \frac{1}{4} \cdot \left(  \mUlp\left( x_\hi \right)^+ -  \mUlp\left( x_\hi \right)  \right) \\
2571& = & \frac{1}{2} \cdot \left( - \mUlp\left( x_\hi \right)^- - \left(  \mUlp\left( x_\hi \right)  -  \mUlp\left( x_\hi \right)^- \right) \right) \\
2572& = & - \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)
2573\end{eqnarray*}
2574further, using also lemma \ref{succtroisfoispuissdeux},
2575\begin{eqnarray*}
2576\left( - \frac{3}{4} \cdot \mUlp\left( x_\hi \right) \right)^+
2577+ \frac{1}{2} \cdot \mUlp\left( \mUlp\left( x_\hi \right) \right)
2578& = & - \frac{1}{4} \cdot \left( 3 \cdot \mUlp\left( x_\hi \right) \right)^+ +
2579\frac{1}{2} \cdot \mUlp\left( \mUlp\left( x_\hi \right) \right) \\
2580& = & - \frac{1}{4} \cdot \left( 3 \cdot \mUlp\left( x_\hi \right)^+ - \mUlp\left( \mUlp\left( x_\hi \right)\right)\right)
2581\\ & & + \frac{1}{2} \cdot \mUlp\left( \mUlp\left( x_\hi \right) \right) \\
2582& = & - \frac{3}{4} \cdot \mUlp\left( x_\hi \right)^+ +
2583\frac{3}{4} \cdot \mUlp\left( \mUlp\left( x_\hi \right) \right) \\
2584& = & \frac{3}{4}\cdot\left( \mUlp\left( x_\hi \right)^+ -\mUlp\left( x_\hi\right) -\mUlp\left( x_\hi \right)^+ \right) \\
2585& = & -\frac{3}{4} \cdot \mUlp\left( x_\hi \right)
2586\end{eqnarray*}
2587and, still with the same lemmas,
2588\begin{eqnarray*}
2589\left( - \frac{3}{4} \cdot \mUlp\left( x_\hi \right) \right)^-
2590- \frac{1}{2} \cdot \mUlp \left( \mUlp\left( x_\hi \right) \right)
2591& = & \frac{1}{4} \left( - 3 \mUlp\left( x_\hi \right) \right)^- -
2592\frac{1}{2} \mUlp\left( \mUlp\left( x_\hi \right) \right) \\
2593& = & \frac{1}{4} \cdot \left( 3 \cdot \mUlp\left( x_\hi \right) - \left( 3 \cdot \mUlp\left( x_\hi \right) \right)^-
2594- 3 \cdot \mUlp\left( x_\hi \right) \right) \\
2595& & - \frac{1}{2} \cdot \mUlp \left( \mUlp \left( x_\hi \right) \right) \\
2596& = & \frac{1}{4} \cdot \left( \left( 3 \cdot \mUlp\left( x_\hi \right) \right)^+ -
25976 \cdot \mUlp\left( x_\hi \right) \right) - \frac{1}{2} \cdot \mUlp \left( \mUlp \left( x_\hi \right) \right) \\
2598& = & \frac{1}{4} \cdot \left( 3 \cdot \mUlp\left( x_\hi \right) \right)^+ - \frac{3}{2} \cdot \mUlp\left( x_\hi \right)
2599- \frac{1}{2} \cdot \mUlp \left( \mUlp \left( x_\hi \right) \right) \\
2600& = & \frac{1}{4} \cdot \left( 3 \cdot \mUlp\left( x_\hi \right)^+ - \mUlp\left(\mUlp\left(x_\hi\right)\right) \right)\\
2601& & - \frac{3}{2} \cdot \mUlp\left( x_\hi \right) - \frac{1}{2} \cdot \mUlp \left( \mUlp\left( x_\hi \right) \right) \\
2602& = & \frac{3}{4} \cdot \left( \mUlp\left( x_\hi \right)^+ - 2 \cdot \mUlp\left( x_\hi \right) -
2603\mUlp\left( \mUlp \left( x_\hi \right) \right) \right) \\
2604& = & \frac{3}{4} \cdot \left( \mUlp\left( x_\hi \right)^+ - 2 \cdot \mUlp\left( x_\hi \right) -
2605\mUlp\left( x_\hi\right)^+ + \mUlp\left( x_\hi \right) \right) \\
2606& = & - \frac{3}{4} \cdot \mUlp\left( x_\hi \right)
2607\end{eqnarray*}
2608and finally
2609\begin{eqnarray*}
2610\left( - \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)^+ + \frac{1}{2} \cdot \mUlp\left(  \mUlp\left( x_\hi \right)  \right)
2611& = & \frac{1}{2} \cdot \left( - \mUlp\left( x_\hi \right)^+ +  \mUlp\left( x_\hi \right)^+ -  \mUlp\left( x_\hi \right)  \right) \\
2612& = & - \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)
2613\end{eqnarray*}
2614For each bound that depends on $\tau$ we are obliged to treat two different cases.\\
2615Let us suppose first that
2616$$\tau = \frac{1}{4} \cdot \mUlp \left( x_\hi \right) $$
2617So we get
2618\begin{eqnarray*}
2619\left( - \frac{1}{4} \cdot  \mUlp\left( x_\hi \right)  \right)^- - \frac{1}{2} \cdot \mUlp\left( \frac{1}{4} \cdot  \mUlp\left( x_\hi \right)  \right)
2620& = & \frac{1}{4} \cdot \left( - \mUlp\left( x_\hi \right)^- - \frac{1}{2} \cdot \left(  \mUlp\left( x_\hi \right)^+
2621-  \mUlp\left( x_\hi \right)  \right) \right) \\
2622& = & \frac{1}{4} \cdot \left( - \mUlp\left( x_\hi \right)^- - \left(  \mUlp\left( x_\hi \right)^- -  \mUlp\left( x_\hi \right)  \right) \right) \\
2623& = & \frac{1}{4} \cdot \left( - \mUlp\left( x_\hi \right)^- -  \mUlp\left( x_\hi \right)^- +  \mUlp\left( x_\hi \right)  \right) \\
2624& = & \frac{1}{4} \cdot  \mUlp\left( x_\hi \right)
2625\end{eqnarray*}
2626and
2627\begin{eqnarray*}
2628\left( - \frac{1}{4} \cdot  \mUlp\left( x_\hi \right)  \right)^+ + \frac{1}{2} \cdot \mUlp\left( \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)
2629& = & \frac{1}{4} \cdot \left( - \mUlp\left( x_\hi \right)^+ +  \mUlp\left( x_\hi \right)^+ -  \mUlp\left( x_\hi \right)  \right) \\
2630& = & - \frac{1}{4} \cdot  \mUlp\left( x_\hi \right)
2631\end{eqnarray*}
2632Let us suppose now
2633$$\tau = \frac{1}{2} \cdot \mUlp \left( x_\hi \right) $$
2634We get thus
2635\begin{eqnarray*}
2636\left( - \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)^- - \frac{1}{2} \cdot \mUlp\left( \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)
2637& = & \frac{1}{2} \cdot \left( - \mUlp\left( x_\hi \right)^- - \frac{1}{2} \cdot \left(  \mUlp\left( x_\hi \right)^+
2638-  \mUlp\left( x_\hi \right)  \right) \right) \\
2639& = & \frac{1}{2} \cdot \left( - \mUlp\left( x_\hi \right)^- - \left(  \mUlp\left( x_\hi \right)^- -  \mUlp\left( x_\hi \right)  \right) \right) \\
2640& = & \frac{1}{2} \cdot \left( - \mUlp\left( x_\hi \right)^- -  \mUlp\left( x_\hi \right)^- +  \mUlp\left( x_\hi \right)  \right) \\
2641& = & \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)
2642\end{eqnarray*}
2643and
2644\begin{eqnarray*}
2645\left( - \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)^+ + \frac{1}{2} \cdot \mUlp\left( \frac{1}{2} \cdot  \mUlp\left( x_\hi \right)  \right)
2646& = & \left(- \frac{1}{2} \cdot  \mUlp\left( x_\hi \right) \right)^+ + \frac{1}{4} \cdot \mUlp\left(  \mUlp\left( x_\hi \right)  \right) \\
2647& \leq & \left(- \frac{1}{2} \cdot  \mUlp\left( x_\hi \right) \right)^+ + \frac{1}{2} \cdot \mUlp\left(  \mUlp\left( x_\hi \right)  \right) \\
2648& = & -\frac{1}{2} \cdot  \mUlp\left( x_\hi \right)
2649\end{eqnarray*}
2650Finally, for all cases, we observe the following intervals:
2651$$x_\mi + x_\lo \in \left( J_1 \cup J_2 \cup J_3 \cup J_4 \cup J_5 \cup J_6 \right) \backslash U$$
2652with
2653\begin{eqnarray*}
2654J_1 & = & \left[ - \mUlp\left( x_\hi \right) ; - \frac{3}{4} \cdot \mUlp\left( x_\hi \right) \right] \\
2655J_2 & = & \left[ - \frac{3}{4} \cdot \mUlp\left( x_\hi \right) ; - \frac{1}{2} \cdot \mUlp\left( x_\hi \right) \right] \\
2656J_3 & = & \left[ - \frac{1}{2} \cdot \mUlp\left( x_\hi \right) ; - \tau \right] \\
2657J_4 & = & \left[ - \tau ; 0 \right] \\
2658J_5 & = & \left[ 0 ; \frac{1}{2} \cdot \mUlp\left( x_\hi \right) \right] \\
2659J_6 & = & \left[ \frac{1}{2} \cdot \mUlp\left( x_\hi \right) ; \mUlp\left( x_\hi \right) \right]
2660\end{eqnarray*}
2661Let us now consider more precisely the set $U$ if impossible cases due to the property that
2662$x_\mi = \circ \left( x_\mi + x_\lo \right)$ and due to the fact that $x_\lo \not = 0$: \\
2663Let us show that $\frac{1}{2} \cdot \mUlp\left( x_\hi \right) \in U$, i.e.
2664$$x_\mi + x_\lo \not = \frac{1}{2} \cdot \mUlp\left( x_\hi \right)$$
2665Let us suppose that this would not be the case. We would get
2666$$x_\mi + x_\lo = \frac{1}{2} \cdot \mUlp\left( x_\hi \right)$$
2667As $x_\mi \not = \frac{1}{2} \cdot \mUlp\left( x_\hi \right)$ as per hypothesis in this branch of the algorithm and because
2668$x_\lo \not = 0$, there must exist a number $\mu \in \R \backslash \left \lbrace 0 \right \rbrace$ such that
2669$x_\mi = \frac{1}{2} \cdot \mUlp\left( x_\hi \right) + \mu$ and that $x_\lo = -\mu$. \\
2670Since $x_\lo = \mu$  must hold, $\mu$ must be a floating point number.
2671Further $$\left \vert \mu \right \vert = \left \vert x_\lo \right \vert \leq \frac{1}{2} \cdot \mUlp\left( x_\mi \right)$$
2672must be justified.
2673So there exist two floating point numbers $\frac{1}{2} \cdot \mUlp\left( x_\hi \right)$ and $x_\mi$ such that
2674their difference verifies
2675\begin{eqnarray*}
2676\left \vert x_\mi - \frac{1}{2} \cdot \mUlp\left( x_\hi \right) \right \vert & = & \left \vert
2677\frac{1}{2} \cdot \mUlp\left( x_\hi \right) + \mu - \frac{1}{2} \cdot \mUlp\left( x_\hi \right) \right \vert \\
2678& = & \left \vert \mu \right \vert \\
2679& \leq & \frac{1}{2} \cdot \mUlp\left( x_\mi \right)
2680\end{eqnarray*}
2681which is possible only if $x_\mi$ is exactly an integer power of $2$. In contrast, as
2682$\frac{1}{2} \cdot \mUlp\left( x_\hi \right)$ is the only one in the interval that is possible for $x_\mi$, which is
2683by the way
2684$\left] \frac{1}{4} \cdot \mUlp\left( x_\hi \right) ; \mUlp\left( x_\hi \right) \right[$, we obtain a contradiction. \\
2685Using a completely analogous argument, one sees further that
2686$$-\tau \in U$$
2687Clearly $0 \in U$ because $x_\lo \not = 0$ and it is less in magnitude than $x_\mi$. \\
2688Let us show finally that
2689$-\mUlp\left( x_\hi \right) \in U$ and that $\mUlp\left( x_\hi \right) \in U$.\\
2690Let us suppose that we would have
2691$$\left \vert x_\mi + x_\lo \right \vert = \mUlp\left( x_\hi \right)$$
2692In contrast we know that $\left \vert x_\mi \right \vert < \mUlp\left( x_\hi \right)$.
2693Since $x_\mi$ is a floating point number, this means that
2694$$\left \vert x_\mi \right \vert \leq \mUlp\left( x_\hi \right)^-$$
2695which yields to
2696\begin{eqnarray*}
2697\left \vert x_\lo \right \vert & \geq & \mUlp\left( x_\hi \right) - \mUlp\left( x_\hi \right)^- \\
2698& = & \frac{1}{2} \cdot \left( \mUlp\left(x_\hi \right)^+ - \mUlp\left( x_\hi \right) \right) \\
2699& = & \frac{1}{2} \cdot \mUlp \left( \mUlp \left( x_\hi \right) \right)
2700\end{eqnarray*}
2701Further we know that $\left \vert x_\mi \right \vert \leq \mUlp\left( x_\hi \right)^-$ and that
2702$\left \vert x_\lo \right \vert \leq \frac{1}{2} \cdot \mUlp\left( x_\mi \right)$.
2703So we can check that
2704\begin{eqnarray*}
2705\left \vert x_\lo \right \vert & \leq & \frac{1}{2} \cdot \mUlp\left( x_\mi \right) \\
2706& = & \frac{1}{2} \cdot \left( \left( \mUlp\left( x_\hi \right)^- \right)^+ - \mUlp\left( x_\hi \right)^+ \right) \\
2707& = & \frac{1}{2} \cdot \left( \mUlp\left( x_\hi \right) - \mUlp\left( x_\hi \right)^- \right) \\
2708& = & \frac{1}{4} \cdot \mUlp \left( \mUlp \left( x_\hi \right) \right)
2709\end{eqnarray*}
2710We have thus obtained a contradiction to the hypothesis that says that
2711$-\mUlp\left( x_\hi \right) \not \in U$ and that $\mUlp\left( x_\hi \right) \not \in U$. \\
2712Let us still show that in the case where $x_\hi$ is an integer power of $2$, i.e.
2713$\exists e \in \Z \mbox{ . } x_\hi = 2^e$, $-\frac{3}{4} \cdot \mUlp\left( x_\hi \right) \in U$.
2714Since $x_\lo \not = 0$, using a similar argument as the one given above, the problem can be reduced to showing
2715that $x_\mi = - \frac{3}{4} \cdot \mUlp \left( x_\hi \right)$ is impossible if $x_\hi$ is an integer power of $2$.
2716Let us suppose the contrary. Since $x_\hi$ is an integer power of $2$, its significand is even. In consequence
2717the significand of $x_\hi^-$ is odd and the one of $x_\hi^{--}$ is again even. So
2718$\circ\left( x_\hi + x_\mi \right) = x_\hi^{--}$ because $x_\hi + x_\mi$ is at the exact middle between
2719$x_\hi^{--}$ and $x_\hi^{-}$ and the significand of $x_\hi^{--}$ is even. It follows that
2720$\left( x_\hi + x_\mi \right) - \circ\left( x_\hi + x_\mi \right) =
2721\frac{1}{2} \cdot \mUlp \left( \circ\left( x_\hi + x_\mi \right) \right)$ which is impossible as per hypothesis. \par
2722Having shown which numbers are in $U$, we can rewrite our intervals as follows
2723$$x_\mi + x_\lo \in J^\prime_1 \cup J^\prime_2 \cup J^\prime_3 \cup J^\prime_4 \cup J^\prime_5 \cup J^\prime_6$$
2724with
2725\begin{eqnarray*}
2726J^\prime_1 & = & \left] - \mUlp\left( x_\hi \right) ; - \frac{3}{4} \cdot \mUlp\left( x_\hi \right) \right] \\
2727J^\prime_2 & = & \left] - \frac{3}{4} \cdot \mUlp\left( x_\hi \right) ;
2728- \frac{1}{2} \cdot \mUlp\left( x_\hi \right) \right[ \\
2729J^\prime_3 & = & \left] - \frac{1}{2} \cdot \mUlp\left( x_\hi \right) ; - \tau \right[ \\
2730J^\prime_4 & = & \left] - \tau ; 0 \right] \\
2731J^\prime_5 & = & \left[ 0 ; \frac{1}{2} \cdot \mUlp\left( x_\hi \right) \right[ \\
2732J^\prime_6 & = & \left] \frac{1}{2} \cdot \mUlp\left( x_\hi \right) ; \mUlp\left( x_\hi \right) \right[
2733\end{eqnarray*}
2734One can trivially check that the rounding $\circ \left( x_\hi + \left( x_\mi + x_\lo \right) \right)$ can be decided without
2735using the rule for even rounding.
2736In particular the cases present themselves as follows \cite{IEEE754}:
2737$$\circ \left( x_\hi + \left( x_\mi + x_\lo\right) \right) = \left \lbrace
2738\begin{array}{ll}
2739x_\hi^{--} & \mbox{ if } x_\mi + x_\lo \in J^\prime_1 \land \exists e \in \Z \mbox{ . } 2^e = x_\hi \\
2740x_\hi^- & \mbox{ if } x_\mi + x_\lo \in J^\prime_1 \land \lnot \exists e \in \Z \mbox{ . } 2^e = x_\hi \\
2741x_\hi^- & \mbox{ if } x_\mi + x_\lo \in J^\prime_2\\
2742x_\hi^- & \mbox{ if } x_\mi + x_\lo \in J^\prime_3\\
2743x_\hi & \mbox{ if } x_\mi + x_\lo \in J^\prime_4 \\
2744x_\hi & \mbox{ if } x_\mi + x_\lo \in J^\prime_5\\
2745x_\hi^+ & \mbox{ if } x_\mi + x_\lo \in J^\prime_6\\
2746\end{array} \right.$$
2747which can be compared to
2748$$\circ \left( x_\hi + x_\mi \right) = \left \lbrace
2749\begin{array}{ll}
2750x_\hi^{--} & \mbox{ if } x_\mi \in I^\prime_1 \land \exists e \in \Z \mbox{ . } 2^e = x_\hi \\
2751x_\hi^- & \mbox{ if } x_\mi \in I^\prime_1 \land \lnot \exists e \in \Z \mbox{ . } 2^e = x_\hi \\
2752x_\hi^- & \mbox{ if } x_\mi \in I^\prime_2\\
2753x_\hi^- & \mbox{ if } x_\mi \in I^\prime_3\\
2754x_\hi & \mbox{ if } x_\mi \in I^\prime_4 \\
2755x_\hi & \mbox{ if } x_\mi \in I^\prime_5\\
2756x_\hi^+ & \mbox{ if } x_\mi \in I^\prime_6\\
2757\end{array} \right.$$
2758Additionally we check that
2759$$\forall i=1, \dots ,6 \mbox{ . } J^\prime_i \subseteq I^\prime_i$$
2760We would therefore get an immediate contradiction if we supposed that
2761$$\circ \left( x_\hi + \left( x_\mi + x_\lo \right) \right) \not = \circ \left( x_\hi + x_\mi \right)$$
2762This finishes the proof for the first case.\\ ~ \\
2763Let us consider now subcases a.) through d.) of the second main case of the proof. We have already shown that
2764the subcases h.) through e.) are equal to the first ones.
2765Without loss of generality we will only analyse the case where $x_\hi > 0$.
2766The set of the floating point numbers as well as the rounding function $\circ \left( \hat{x} \right)$
2767are symmetrical around $0$.
2768We can therefore suppose that
2769$$x_\mi = - \left \lbrace \begin{array}{ll}
2770\frac{1}{4} \cdot \mUlp\left(x_\hi \right) & \mbox{if } \exists e \in \Z \mbox{ . } 2^e = x_\hi \\
2771\frac{1}{2} \cdot \mUlp\left(x_\hi \right) & \mbox{otherwise} \end{array} \right.$$
2772or that
2773$$x_\mi = \frac{1}{2} \cdot \mUlp\left(x_\hi \right)$$
2774depending on whether $x_\mi$ is negative or positive.\\
2775It is clear that one can suppose that
2776$$\left \vert x_\mi + x_\lo \right \vert < \mUlp\left( x_\hi \right)$$
2777because otherwise we would have $\left \vert x_\lo \right \vert \geq \frac{1}{2} \cdot \mUlp\left( x_\hi \right)$ whilst
2778$\left \vert x_\lo \right \vert \leq 2^{-53} \cdot \mUlp\left( x_\hi \right)$.\\
2779Let us treat now the four cases one after another:
2780{
2781\renewcommand{\labelenumi}{\alph{enumi}.)}
2782\begin{enumerate}
2783\item We can suppose in this case that $x_\mi > 0$ and that $x_\lo > 0$: \\
2784So
2785$$\mUlp\left( x_\hi \right) > x_\mi + x_\lo > \frac{1}{2} \cdot \mUlp\left(x_\hi \right)$$
2786Thus since the inequalities are strict
2787$$\circ \left( x_\hi + \left( x_\mi + x_\lo \right) \right) = x_\hi^+ = \succ\left( x_\hi \right)$$
2788which is the number returned by the algorithm.
2789\item We have here $x_\mi > 0$ and $x_\lo < 0$: \\
2790So the same way, we know that
2791$$x_\mi + x_\lo < \frac{1}{2} \cdot \mUlp\left(x_\hi \right)$$
2792Additionally, we know that $x_\lo \geq -2^{-53} \cdot \mUlp\left(x_\hi \right) > -\frac{1}{4} \cdot \mUlp\left( x_\hi \right)$.
2793This yields thus to
2794$$\circ \left( x_\hi + \left( x_\mi + x_\lo \right) \right) = x_\hi$$
2795The correctness of the algorithm is therefore verified also in this case.
2796\item In this case one knows that $x_\mi < 0$ and $x_\lo > 0$. In consequence
2797$$x_\mi = - \tau$$
2798with $$\tau = \left \lbrace \begin{array}{ll}
2799\frac{1}{4} \cdot \mUlp\left(x_\hi \right) & \mbox{if } \exists e \in \Z \mbox{ . } 2^e = x_\hi \\
2800\frac{1}{2} \cdot \mUlp\left(x_\hi \right) & \mbox{otherwise} \end{array} \right.$$
2801Thus we get
2802$$\frac{1}{4} \cdot \mUlp\left( x_\hi \right) > 2^{-53} \cdot \mUlp \left( x_\hi \right) > x_\mi + x_\lo > -\tau$$
2803mentioning analogous arguments as the ones given above. This yields to
2804$$\circ \left( x_\hi + \left( x_\mi + x_\lo \right) \right) = x_\hi$$
2805which is the number returned by the algorithm.
2806\item Finally if $x_\mi < 0$ and $x_\lo < 0$ one checks that
2807$$-2 \cdot \tau < x_\mi + x_\lo < -\tau$$
2808The lower bound given for $x_\mi + x_\lo$ can be explained as follows.
2809If $\tau = \frac{1}{2} \cdot \mUlp\left( x_\hi \right)$, it trivially holds due to the bound:
2810$$\left \vert x_\mi + x_\lo \right \vert < \mUlp\left( x_\hi \right)$$
2811We have already indicated this bound.
2812Otherwise we know that $\tau = \frac{1}{4} \cdot \mUlp\left( x_\hi \right)$ and that $x_\mi = -\tau$.
2813Since $\left \vert x_\lo \right \vert \leq 2^{-53} \cdot \left \vert x_\mi \right \vert$, one gets
2814$$x_\mi + x_\lo > - \left( \frac{1}{4} + 2^{-55} \right) \cdot \mUlp\left( x_\hi \right) > -2 \cdot \tau$$
2815Thus the bounds obtained for $x_\mi + x_\lo$ imply always that
2816$$\circ \left( x_\hi + \left( x_\mi + x_\lo \right) \right) = x_\hi^- = \pred\left( x_\hi \right)$$
2817Thus in this subcase, too, and therefore in all cases, the algorithm returns a floating point number $x^\prime$
2818which is equal to $\circ \left( x_\hi + x_\mi + x_\lo \right)$.
2819\end{enumerate}
2820}
2821By this final statement we have finished the proof.\qed
2822\end{proof}
2823\subsection{Final rounding for the directed modes}
2824As we have already mentioned, the three directed rounding modes behave all in a similar fashion. On the one hand
2825we have
2826$$\forall \hat{x} \in \R \mbox{ . } \diamond \left( \hat{x} \right) = \left \lbrace
2827\begin{array}{ll}
2828\triangledown \left( \hat{x} \right) & \mbox{ if } \hat{x} < 0 \\
2829\vartriangle \left( \hat{x} \right) & \mbox{ otherwise}
2830\end{array} \right. $$
2831On the other hand, one can check that
2832$$\forall \hat{x} \in \R \mbox{ . } \vartriangle \left( \hat{x} \right) = - \triangledown \left( - \hat{x} \right)$$
2833The given equations are also verified on the set of the floating point numbers $\F$ \cite{Defour-thesis, IEEE754}.
2834We will therefore refrain from treating each directed rounding mode separately but we will consider them all in
2835common. So slightly deriving from our notations, we will notate $\diamond$ the rounding function of all possible three
2836directed rounding modes.\par
2837Further we suppose that we dispose of a correct rounding procedure for each directed rounding mode capable
2838of rounding a double number $x_\hi + x_\lo$. This procedure will return in fact $\diamond \left( x_\hi + x_\lo \right)$
2839\cite{crlibmweb, Defour-thesis}.
2840For constructing a correct rounding procedure for triple-double precision, we will try to give a reduction
2841procedure for reducing a triple-double number into a double-double number such that the directed
2842rounding of both triple-double and double-double numbers be equal.
2843\begin{lemma}[Directed rounding decision] \label{decarrdir} ~ \\
2844Let be $x \in \F$ a floating point number. \\
2845Let be $\mu, \nu \in \R$ two real numbers such that $\left \vert \mu \right \vert < \mUlp\left( x \right)$ and
2846$\left \vert \nu \right \vert < \mUlp\left( x \right)$  and that
2847$$\sgn\left( \mu \right) = \sgn\left( \nu \right)$$
2848So the following equation holds
2849$$\diamond \left( x + \mu \right) = \diamond\left( x + \nu \right)$$
2850\end{lemma}
2851\begin{proof} ~ \\
2852We know by definition of the rounding mode, e.g. by the one of rounding $\vartriangle$ towards $+\infty$ that
2853$$\forall y \in \F, \mu \in \R, \left \vert \mu \right \vert < \mUlp\left( y \right) \mbox{ . }
2854\vartriangle \left( y + \rho \right) = \left \lbrace \begin{array}{ll}
2855\succ\left(y\right) & \mbox{ if } \rho > 0 \\
2856y & \mbox{ otherwise}
2857\end{array} \right. $$
2858In fact, the rounding result $\vartriangle\left( y + \rho \right)$ is the smallest floating point number greater or equal
2859to
2860$y + \rho$. \\
2861Since $x$ is a floating point number and as
2862$\pred\left( x \right) < x + \mu < \succ\left( x \right)$ and $\pred\left( x \right) < x + \mu < \succ\left( x \right)$
2863because $\left \vert \mu \right \vert < \mUlp\left( x \right)$ and $\left \vert \mu \right \vert < \mUlp\left( x \right)$,
2864supposing that $\diamond \left( x + \mu \right) \not = \diamond \left( x + \nu \right)$ would yield to an immediate contradiction.\qed
2865\end{proof}
2866\begin{lemma}[Disturbed directed rounding] \label{arrdirper} ~ \\
2867Let be $\hat{x} \in \R$ a real number and $x = \circ\left( \hat{x} \right) \in \F$ the (even) floating point number nearest to
2868$\hat{x}$.
2869Let be $\xi\left(\hat{x}\right) = \hat{x} - x$. \\
2870Let be $\delta \in \R$ such that
2871$$\left \vert \delta \right \vert < \left \vert \xi\left(\hat{x}\right) \right \vert$$
2872So the following equation holds
2873$$\diamond \left( \hat{x} \right) = \diamond \left( \hat{x} + \delta \right)$$
2874\end{lemma}
2875Let us remark still that the inequality in hypothesis
2876-- $\left \vert \delta \right \vert < \left \vert \xi\left( \hat{x} \right) \right \vert$ --
2877must be assured to be strict.
2878\begin{proof} ~ \\
2879We know already that
2880$$\diamond \left( \hat{x} + \delta \right) = \diamond \left( x + \xi\left( \hat{x} \right) + \delta \right)$$
2881Let us show now that $\xi\left( \hat{x} \right)$ and $\xi\left( \hat{x} \right) + \delta$ have the same sign.
2882Let us therefore suppose that this would not be the case.
2883Without loss of generality, it suffices to consider the case where $\xi\left( \hat{x} \right)$ is positive; the
2884inverse case can be treated completely analogously. \\
2885Thus $$\xi\left( \hat{x} \right) \geq 0$$ and $$\xi\left( \hat{x} \right) + \delta < 0$$
2886In consequence $$\xi\left( \hat{x} \right) < - \delta$$
2887On the other hand $$\left \vert \delta \right \vert < \left \vert \xi\left( \hat{x} \right) \right \vert$$
2888Thus
2889$$0 \leq \xi\left( \hat{x} \right) < \xi\left( \hat{x} \right)$$
2890which yields to
2891$$\xi\left( \hat{x} \right) = 0$$
2892In this case we know that $$\delta = 0$$ as per the hypotheses of the theorem. Thus contradiction and we know that
2893$\xi\left( \hat{x} \right)$ and $\xi\left( \hat{x} \right) + \delta$ have really the same sign.\\
2894It is clear that $\xi\left( \hat{x} \right) \leq \frac{1}{2} \cdot \mUlp\left( x \right)$ because the rounding of $\hat{x}$
2895towards $x$ is done to the nearest floating point number. In consequence, since $\delta < \xi\left( \hat{x} \right)$ we obtain
2896$$\xi\left( \hat{x} \right) + \delta < \mUlp\left( x \right)$$
2897As $x$ is a floating point number it suffices thus to conclude using lemma \ref{decarrdir}
2898by putting $\mu = \xi\left( \hat{x} \right)$ and
2899$\nu = \xi\left( \hat{x} \right) + \delta$.\qed
2900\end{proof}
2901\begin{lemma}[Reduction of a triple-double into a double-double -- simple case] \label{moinsquunmiulp} ~ \\
2902Let be $x_\hi + x_\mi + x_\lo \in \F + \F + \F$ a non-overlapping triple-double number such that $x_\lo$ is not subnormal, such that
2903$x_\mi = \circ \left( x_\mi + x_\lo \right)$ and such that $\left \vert x_\mi \right \vert < \tau$ where
2904$$\tau = \left \lbrace \begin{array}{ll}
2905\frac{1}{4} \cdot \mUlp\left( x_\hi \right) & \mbox{ if } \exists e \in \Z \mbox{ . } 2^e = \left \vert x_\hi \right \vert \land
2906\sgn\left( x_\mi \right) = -\sgn\left( x_\hi \right)\\
2907\frac{1}{2} \cdot \mUlp\left( x_\hi \right) & \mbox{ otherwise} \end{array} \right.$$
2908Given the instruction sequence below:
2909\begin{center}
2910\begin{minipage}[b]{50mm}
2911$\left( t_1, t_2 \right) \gets \mAdd\left( x_\hi, x_\mi \right)$ \\
2912$t_3 \gets t_2 \oplus x_\lo$
2913\end{minipage}
2914\end{center}
2915the following equation holds after the execution of the sequence
2916$$\diamond\left( t_1 + t_3 \right) = \diamond\left( x_\hi + x_\mi + x_\lo \right)$$
2917\end{lemma}
2918\begin{proof} ~ \\
2919Due to the hypothesis that $\left \vert x_\mi \right \vert < \tau$ we can suppose that $x_\hi = \circ \left( x_\hi + x_\mi \right)$.
2920In consequence, using the properties of the \Add~ procedure, we know that we have exactly
2921$$t_1 = \circ \left( x_\hi + x_\mi \right) = x_\hi$$
2922and
2923$$t_2 = x_\hi + x_\mi - t_1 = x_\mi$$
2924So since as per hypothesis we have $x_\mi = \circ \left( x_\mi + x_\lo \right)$, we know also that
2925$t_3$ verifies exactly
2926$$t_3 = x_\mi \oplus x_\lo = \circ\left( x_\mi + x_\lo \right) = x_\mi$$
2927Let us put now
2928$$\delta = x_\lo$$
2929and
2930$$\hat{x} = t_1 + t_3$$
2931Clearly we get
2932\begin{eqnarray*}
2933\xi\left( \hat{x} \right) & = & \hat{x} - \circ\left( \hat{x} \right) \\
2934& = & t_1 + t_3 - \circ\left( t_1 + t_3 \right) \\
2935& = & x_\hi + x_\mi - \circ\left( x_\hi + x_\mi \right) \\
2936& = & x_\hi + x_\mi - x_\hi \\
2937& = & x_\mi
2938\end{eqnarray*}
2939Let us show now that
2940$$\left \vert \delta \right \vert < \left \vert \xi\left( \hat{x} \right) \right \vert$$
2941Amongst other by the lemma's hypotheses and due to the fact that $x_\mi \not = 0$, we can check that
2942\begin{eqnarray*}
2943\left \vert \xi\left( \hat{x} \right) \right \vert
2944& = & \left \vert x_\mi \right \vert \\
2945& > & 2^{-53} \cdot \left \vert x_\mi \right \vert \\
2946& \geq & \left \vert x_\lo \right \vert
2947\end{eqnarray*}
2948The inequality the lemma \ref{arrdirper} asks for in hypothesis is well verified.\\
2949So as per the same lemma \ref{arrdirper} we know that
2950$$\diamond \left( \hat{x} + \delta \right) = \diamond\left( \hat{x} \right)$$
2951This means that
2952$$\diamond \left( x_\hi + x_\mi + x_\lo \right) = \diamond\left( t_1 + t_3 \right)$$
2953which is the equation that was to be shown.\qed
2954\end{proof}
2955\begin{lemma}[Reduction of a triple-double into a double-double -- difficult case] \label{plusdunmiulp} ~ \\
2956Let be $x_\hi + x_\mi + x_\lo \in \F + \F + \F$ a non-overlapping triple-double number such that $x_\lo$ is not subnormal, such that
2957$x_\mi = \circ \left( x_\mi + x_\lo \right)$ and that $\left \vert x_\mi \right \vert \geq \tau$ where
2958$$\tau = \left \lbrace \begin{array}{ll}
2959\frac{1}{4} \cdot \mUlp\left( x_\hi \right) & \mbox{ if } \exists e \in \Z \mbox{ . } 2^e = \left \vert x_\hi \right \vert \land
2960\sgn\left( x_\mi \right) = -\sgn\left( x_\hi \right)\\
2961\frac{1}{2} \cdot \mUlp\left( x_\hi \right) & \mbox{ otherwise} \end{array} \right.$$
2962Given the instruction sequence below
2963\begin{center}
2964\begin{minipage}[b]{50mm}
2965$\left( t_1, t_2 \right) \gets \mAdd\left( x_\hi, x_\mi \right)$ \\
2966$t_3 \gets t_2 \oplus x_\lo$
2967\end{minipage}
2968\end{center}
2969the following equation holds after the execution of the sequence
2970$$\diamond\left( t_1 + t_3 \right) = \diamond\left( x_\hi + x_\mi + x_\lo \right)$$
2971\end{lemma}
2972\begin{proof} ~ \\
2973Without loss of generality, let us suppose in the sequel that $x_\hi > 0$. This is legitime because the set of the
2974floating point numbers is symmetrical around $0$. In fact it suffices to apply lemma \ref{commut} and
2975definition \ref{defulp} in order to obtain a proof for each case.\\
2976In what follows we will proceed as that: we will decompose the problem in several cases and subcases that we will
2977treat one after another. For each of this subcases we will show either directly the desired result or the fact that
2978$\left \vert t_2 \right \vert \geq \left \vert x_\lo \right \vert$.
2979In the end we will prove that this fact yields to the correctness of the lemma in each case.\\
2980Let us start by considering the case where $\tau = \frac{1}{2} \cdot \mUlp\left( x_\hi \right)$.
2981Thus $x_\hi$ is not an exact integer power of $2$.\\
2982We therefore get
2983$$\frac{1}{2} \leq \left \vert x_\mi \right \vert < \mUlp\left( x_\hi \right)$$
2984which is equivalent to
2985$$\frac{1}{2} \leq \left \vert x_\mi \right \vert \leq \mUlp\left( x_\hi \right)^-$$
2986because $x_\mi$ is a floating point number.\\
2987We can check now that
2988$$t_1 = \circ \left( x_\hi + x_\mi \right) = \left \lbrace \begin{array}{ll}
2989x_\hi^+ & \mbox{ if } x_\mi > 0 \\
2990x_\hi & \mbox{ if } x_\mi = \frac{1}{2} \cdot \mUlp\left( x_\hi \right) \mbox{ and the significand of } x_\hi \mbox{ is even} \\
2991x_\hi^- & \mbox{ if } x_\mi < 0
2992\end{array} \right.$$
2993This implies the handling of three different subcases. \\
2994Let as treat first the case where $t_1 = x_\hi$: \\
2995We get here
2996\begin{eqnarray*}
2997t_2 & = & x_hi + x_\mi - t_1 \\
2998& = & x_\hi + x_\mi - x_\hi \\
2999& = & x_\mi
3000\end{eqnarray*}
3001and further
3002\begin{eqnarray*}
3003t_3 & = & t_2 \oplus x_\lo \\
3004& = & x_\mi \oplus x_\lo \\
3005& = & \circ \left( x_\mi + x_\lo \right) \\
3006& = & x_\mi
3007\end{eqnarray*}
3008as per the hypothesis on the arguments.  \\
3009So let us put
3010\begin{eqnarray*}
3011\hat{x} & = & t_1 + t_3 \\
3012\delta & = & x_\lo
3013\end{eqnarray*}
3014Thus
3015\begin{eqnarray*}
3016\hat{x} & = & x_\hi + x_\mi \\
3017\xi\left( \hat{x} \right) & = & \circ \left( \hat{x} \right) \\
3018& = & \circ \left( t_1 + t_2 \right) \\
3019& = & t_2 \\
3020& = & t_3
3021\end{eqnarray*}
3022and
3023$$\left \vert \delta \right \vert < \left \vert \xi\left( \hat{x} \right) \right \vert$$
3024because
3025$$\left \vert x_\lo \right \vert \leq 2^{-53} \cdot \left \vert x_\mi \right \vert$$
3026et $$x_\mi \not = 0$$
3027Applying lemma \ref{arrdirper} we thus obtain
3028$$\diamond \left( t_1 + t_3 \right) = \diamond \left( x_\hi + x_\mi + x_\lo \right)$$
3029Let us continue with the case where $t_1 = x_\hi^+$: \\
3030We get here
3031\begin{eqnarray*}
3032t_2 & = & x_\hi + x_\mi + t_1 \\
3033& = & x_\hi + x_\mi - x_\hi^+ \\
3034& = & - \left( x_\hi^+ - x_\hi \right) + x_\mi \\
3035& = & - \mUlp\left( x_\hi \right) + x_\mi \\
3036& \leq & -\mUlp\left( x_\hi \right) + \mUlp\left( x_\hi \right)^- \\
3037& = & - \left( \mUlp\left( x_\hi \right) - \mUlp\left( x_\hi \right)^- \right) \\
3038& = & - \frac{1}{2} \cdot \left( \mUlp\left( x_\hi \right)^+ - \mUlp\left( x_\hi \right) \right) \\
3039& = & - \frac{1}{2} \cdot \mUlp\left( \mUlp \left( x_\hi \right) \right)
3040\end{eqnarray*}
3041Thus
3042$$\left \vert t_2 \right \vert \geq \frac{1}{2} \cdot \mUlp\left( \mUlp \left( x_\hi \right) \right)$$
3043In contrast $\left \vert x_\lo \right \vert \leq \frac{1}{2} \cdot \mUlp\left( \mUlp \left( x_\hi \right) \right)$
3044as per hypothesis which implies
3045$$\left \vert t_2 \right \vert \geq \left \vert x_\lo \right \vert$$
3046Let us finally check the properties to be show for the third and last subcase, supposing now that
3047$t_1 = x_\hi^-$. \\
3048Since $x_\hi$ is not exactly an integer power of $2$, we can check the following applying amongst other
3049lemma \ref{notpoweroftwo}:
3050\begin{eqnarray*}
3051t_2 & = & x_\hi + x_\mi - t_1 \\
3052& = & x_\hi + x_\mi - x_\hi^- \\
3053& = & x_\hi^+ - x_\hi + x_\mi \\
3054& = & \mUlp\left( x_\hi \right) + x_\mi \\
3055& \geq & \mUlp\left( x_\hi \right) - \mUlp\left( x_\hi \right)^- \\
3056& = & \frac{1}{2} \cdot \mUlp\left( \mUlp \left( x_\hi \right) \right)
3057\end{eqnarray*}
3058We therefore still get
3059$$\left \vert t_2 \right \vert \geq \left \vert x_\lo \right \vert$$
3060using the same argument as the one given above. \\ ~ \\
3061Let us handle now the case where $\tau = \frac{1}{4} \cdot \mUlp\left( x_\hi \right)$: \\
3062We can suppose in this case that $x_\hi$ is an exact integer power of $2$ and that $x_\mi$ is negative
3063because we had already supposed that $x_\hi$ is positive and because we know that
3064$\sgn\left( x_\hi \right) = -\sgn\left( x_\mi \right)$. We get further the following bounds for $x_\mi$:
3065$$\frac{1}{4} \cdot \mUlp\left( x_\hi \right) \leq \left \vert x_\mi \right \vert \leq \mUlp\left( x_\hi \right)^-$$
3066which means that
3067$$-\mUlp\left( x_\hi \right)^- \leq x_\mi \leq -\frac{1}{4} \cdot \mUlp\left( x_\hi \right)$$
3068still because $x_\mi$ is a floating point number. \\
3069Since $x_\hi$ is an integer power of $2$ and as for this reason, its significand is even, one can check that
3070$$t_1 = \circ \left( x_\hi + x_\mi \right) = \left \lbrace \begin{array}{ll}
3071x_\hi & \mbox{ if } x_\mi = -\frac{1}{4} \cdot \mUlp\left( x_\hi \right) \\
3072x_\hi^- & \mbox{ if } -\frac{1}{2} \cdot \mUlp\left( x_\hi \right) < x_\mi < -\frac{1}{4} \cdot \mUlp\left( x_\hi \right) \\
3073x_\hi^- & \mbox{ if } x_\mi = -\frac{1}{2} \cdot \mUlp\left( x_\hi \right) \\
3074x_\hi^- & \mbox{ if } -\frac{3}{4} \cdot \mUlp\left( x_\hi \right) < x_\mi < -\frac{1}{2} \cdot \mUlp\left( x_\hi \right) \\
3075x_\hi^{--} & \mbox{ if } -\mUlp\left( x_\hi \right)^- \leq x_\mi \leq -\frac{3}{4} \cdot \mUlp\left( x_\hi \right)
3076\end{array} \right.
3077$$
3078The assertion that $t_1 = x_\hi^-$ if $x_\mi = -\frac{1}{2} \cdot \mUlp\left( x_\hi \right)$ can be explained as follows:\\
3079We have
3080\begin{eqnarray*}
3081x_\hi + x_\mi & = & x_\hi - \frac{1}{2} \cdot \mUlp\left( x_\hi \right) \\
3082& = & x_\hi - \frac{1}{2} \cdot \left( x_\hi^+ - x_\hi \right) \\
3083& = & x_\hi - \left( x_\hi - x_\hi^- \right) \\
3084& = & x_\hi^-
3085\end{eqnarray*}
3086Thus $$\circ \left( x_\hi + x_\mi \right) = \circ \left( x_\hi^- \right) = x_\hi^-$$
3087because $x_\hi^-$ is clearly a floating point number.
3088Let us consider now first the cases where we have equations, i.e. the cases where
3089$x_\mi = -\frac{1}{4} \cdot \mUlp\left( x_\hi \right)$ and
3090$x_\mi = - \frac{1}{2} \cdot \mUlp\left( x_\hi \right)$: \\
3091Let us commence by the case where $x_\mi = -\frac{1}{4} \cdot \mUlp\left( x_\hi \right)$: \\
3092We get here
3093\begin{eqnarray*}
3094t_2 & = & x_\hi + x_\mi - t_1 \\
3095& = & x_\hi + x_\mi - x_\hi \\
3096& = & x_\mi
3097\end{eqnarray*}
3098and we can check that the following holds by the hypotheses on the arguments
3099\begin{eqnarray*}
3100t_3 & = & x_\mi \oplus x_\lo \\
3101& = & \circ \left( x_\mi + x_\lo \right) \\
3102& = & x_\mi
3103\end{eqnarray*}
3104Let us put now
3105\begin{eqnarray*}
3106\hat{x} & = & t_1 + t_3 \\
3107\delta & = & x_\lo \\
3108\xi\left( \hat{x} \right) & = & \circ\left( \hat{x} \right) - \hat{x} = t_3
3109\end{eqnarray*}
3110So by applying lemma \ref{arrdirper}, we get
3111$$\diamond \left( t_1 + t_3 \right) = \diamond \left( x_\hi + x_\mi + x_\lo \right)$$
3112because
3113$$\left \vert x_\lo \right \vert \leq 2^{-53} \cdot \left \vert x_\mi \right \vert$$
3114and $x_\mi \not = 0$ which is a hypothesis of the lemma to prove. \\
3115Let us now handle the second of these particular cases, i.e. the cases where
3116$x_\mi = -\frac{1}{2} \cdot \mUlp\left( x_\hi \right)$: \\
3117We get
3118\begin{eqnarray*}
3119t_2 & = & x_\hi + x_\mi - t_1 \\
3120& = & x_\hi + x_\mi - x_\hi^- \\
3121& = & \frac{1}{2} \cdot \mUlp\left( x_\hi \right) + x_\mi \\
3122& = & \frac{1}{2} \cdot \mUlp\left( x_\hi \right) - \frac{1}{2} \cdot \mUlp\left( x_\hi \right) \\
3123& = & 0
3124\end{eqnarray*}
3125So in consequence we have
3126\begin{eqnarray*}
3127t_3 & = & t_2 \oplus x_\lo \\
3128& = & 0 \oplus x_\lo \\
3129& = & x_\lo
3130\end{eqnarray*}
3131And we thus obtain finally
3132\begin{eqnarray*}
3133\diamond \left( x_\hi + x_\mi + x_\lo \right) & = & \diamond \left( t_1 + t_2 + x_\lo \right) \\
3134& = & \diamond \left( t_1 + 0 + x_\lo \right) \\
3135& = & \diamond \left( t_1 + t_3 \right)
3136\end{eqnarray*}
3137Let us now analyse the other principal cases, starting with the case where
3138$$-\frac{1}{2} \cdot \mUlp\left( x_\hi \right) < x_\mi < -\frac{1}{4} \cdot \mUlp\left( x_\hi \right)$$
3139This inequality bounding $x_\mi$ is in fact equivalent to the following one because $x_\mi$ is a floating point number:
3140$$-\frac{1}{2} \cdot \mUlp\left( x_\hi \right)^- \leq x_\mi \leq -\frac{1}{4} \cdot \mUlp\left( x_\hi \right)^+$$
3141So we can check
3142\begin{eqnarray*}
3143t_2 & = & x_\hi + x_\mi - t_1 \\
3144& = & x_\hi + x_\mi - x_\hi^- \\
3145& = & \frac{1}{2} \cdot \mUlp\left( x_\hi \right) + x_\mi \\
3146& \geq & \frac{1}{2} \cdot \mUlp\left( x_\hi \right) - \frac{1}{2} \cdot \mUlp\left( x_\hi \right)^- \\
3147& = & \frac{1}{2} \cdot \left( \mUlp\left( x_\hi \right) - \mUlp\left( x_\hi \right)^- \right) \\
3148& = & \frac{1}{4} \mUlp\left( \mUlp\left( x_\hi \right) \right)
3149\end{eqnarray*}
3150In contrast we know that
3151$$\left \vert x_\lo \right \vert \leq \frac{1}{2} \cdot \mUlp \left( x_\mi \right)$$
3152Since in the currently treated case the following holds
3153$$\left \vert x_\mi \right \vert \leq \frac{1}{2} \cdot \mUlp\left( x_\hi \right)$$
3154we get as per lemma \ref{multhalf}
3155$$\left \vert x_\lo \right \vert \leq \frac{1}{4} \cdot \mUlp\left( \mUlp\left( x_\hi \right) \right)$$
3156which yields to
3157$$\left \vert t_2 \right \vert \geq \left \vert x_\lo \right \vert$$
3158Let us now consider the second and one but not least case. We suppose here that
3159$$-\frac{3}{4} \cdot \mUlp\left( x_\hi \right) < x_\mi < -\frac{1}{2} \cdot \mUlp\left( x_\hi \right)$$
3160which is equivalent to
3161$$-\left(\frac{3}{4} \cdot \mUlp\left( x_\hi \right)\right)^- \leq x_\mi < -\frac{1}{2} \cdot \mUlp\left( x_\hi \right)^+$$
3162We therefore get
3163\begin{eqnarray*}
3164t_2 &= & x_\hi + x_\mi - t_1 \\
3165& = & x_\hi + x_\mi - x_\hi^- \\
3166& = & \frac{1}{2} \cdot \mUlp\left( x_\hi \right) + x_\mi \\
3167& \leq & \frac{1}{2} \cdot \mUlp\left( x_\hi \right) - \frac{1}{2} \cdot \mUlp\left( x_\hi \right)^+ \\
3168& = & -\frac{1}{2} \cdot \left( \mUlp\left( x_\hi \right)^+ - \mUlp\left( x_\hi \right) \right) \\
3169& = & -\frac{1}{2} \cdot \mUlp\left( \mUlp\left( x_\hi \right) \right)
3170\end{eqnarray*}
3171which gives us
3172$$\left \vert t_2 \right \vert \geq \frac{1}{2} \cdot \mUlp\left( \mUlp\left( x_\hi \right) \right)$$
3173We can deduce from that, still using the argument that
3174$\left \vert x_\lo \right \vert \leq \frac{1}{2} \cdot \mUlp\left( \mUlp \left( x_\hi \right) \right)$, that
3175$$\left \vert t_2 \right \vert \geq \left \vert x_\lo \right \vert $$
3176Let us finally handle the last case where $-\mUlp\left( x_\hi \right)^- \leq x_\mi \leq - \frac{3}{4} \cdot \mUlp\left( x_\hi \right)$: \\
3177Using the property that $x_\hi^-$ is an exact integer power of $2$ and using further
3178lemma \ref{notpoweroftwo}, we can check now that
3179\begin{eqnarray*}
3180t_2 & = & x_\hi + x_\mi - t_1 \\
3181& = & x_\hi + x_\mi - x_\hi^{--} \\
3182& = & x_\hi + x_\mi - x_\hi^{--} + x_\hi^- - x_\hi^- \\
3183& = & x_\hi - x_\hi^- + x_\mi + x_\hi^- - x_\hi^{--} \\
3184& = & \frac{1}{2} \cdot \mUlp\left( x_\hi \right) + x_\mi + \left( x_\hi^- \right)^+ - x_\hi^- \\
3185& = & \frac{1}{2} \cdot \mUlp\left( x_\hi \right) + x_\mi + x_\hi - x_\hi^- \\
3186& = & \frac{1}{2} \cdot \mUlp\left( x_\hi \right) + x_\mi + \frac{1}{2} \cdot \mUlp\left( x_\hi \right) \\
3187& = & \mUlp\left( x_\hi \right) + x_\mi \\
3188& \geq & \mUlp\left( x_\hi \right) + \mUlp\left( x_\hi \right)^- \\
3189& = & \frac{1}{2} \cdot \mUlp\left( \mUlp\left( x_\hi \right) \right)
3190\end{eqnarray*}
3191In consequence we still get the same upper bound for $\left \vert x_\lo \right \vert$, i.e.
3192$$\left \vert t_2 \right \vert \geq \left \vert x_\lo \right \vert$$
3193Since we have now treated all the cases that have been showing up, it suffices now to show that the upper bound
3194already mentioned yields to the property to be proven. Once again, we decompose the problem in cases and subcases.\\
3195Let us start by showing the property for the equation $\left \vert t_2 \right \vert = \left \vert x_\lo \right \vert$: \\
3196If $\sgn\left( t_2 \right) = \sgn\left( x_\lo \right)$ we get
3197\begin{eqnarray*}
3198t_3 & = & t_2 \oplus x_\lo \\
3199& = & x_\lo \oplus x_\lo \\
3200& = & \circ \left( 2 \cdot x_\lo \right) \\
3201& = & 2 \cdot x_\lo
3202\end{eqnarray*}
3203So we have exactly
3204$$t_1 + t_3 = x_\hi + x_\mi + x_\lo$$
3205and thus
3206$$\diamond \left( t_1 + t_3 \right) = \diamond \left( x_\hi + x_\mi + x\lo \right)$$
3207Otherwise, we have $\sgn\left( t_2 \right) = -\sgn\left( x_\lo \right)$ and get
3208\begin{eqnarray*}
3209t_3 & = & t_2 \oplus x_\lo \\
3210& = & - x_\lo \oplus x_\lo \\
3211& = & 0
3212\end{eqnarray*}
3213exactly.
3214This means finally that
3215\begin{eqnarray*}
3216\diamond \left( t_1 + t_3 \right) & = & \diamond \left( t_1 \right) \\
3217& = & \diamond \left( t_1 + t_2 - t_2 \right) \\
3218& = & \diamond \left( x_\hi + x_\mi + x_\lo \right)
3219\end{eqnarray*}
3220In the end let us consider the case where one can suppose that
3221$\left \vert t_2 \right \vert > \left \vert x_\lo \right \vert$: \\
3222We can suppose here
3223\begin{eqnarray*}
3224t_3 & = & t_2 \oplus x_\lo \\
3225& = & t_2 + x_\lo + \delta
3226\end{eqnarray*}
3227with
3228$$\left \vert \delta \right \vert \leq 2^{-53} \cdot \left \vert t_2 + x_\lo \right \vert$$
3229Let us show now that $t_2$ and $t_3$ have the same sign. For doing so let us suppose that this would not be true.\\
3230Clearly, $t_2$ and $t_2 + x_\lo$ have the same sign because we know that
3231$\left \vert t_2 \right \vert > \left \vert x_\lo \right \vert$. \\
3232So in order to have $\sgn\left( t_2 \right) = -1 \cdot \sgn\left( t_3 \right)$ to hold, we must have
3233$$\left \vert \delta \right \vert > \left \vert t_2 + x_\lo \right \vert$$
3234Thus we would obtain
3235$$2^{-53} \cdot \left \vert t_2 + x_\lo \right \vert > \left \vert t_2 + x_\lo \right \vert$$
3236which is not true because
3237$$t_2 + x_\lo = 0$$
3238This would yield to $\left \vert t_2 \right \vert = \left \vert x_\lo \right \vert$ which is excluded by hypotheses.
3239Thus, contradiction. \\
3240The values $t_2$ and $t_3$ have therefore the same sign. By applying lemma \ref{decarrdir}, we get:
3241$$\diamond \left( t_1 + t_2 \right) = \diamond \left( t_1 + t_3 \right)$$
3242Let us show now that
3243$$\diamond \left( t_1 + t_2 \right) = \diamond \left( x_\hi + x_\mi + x_\lo \right)$$
3244in order to be able to conclude. \\
3245For doing so, let us put
3246\begin{eqnarray*}
3247\hat{x} & = & t_1 + t_2 \\
3248\delta^\prime & = & x_\lo \\
3249\xi\left( \hat{x} \right) & = & t_2
3250\end{eqnarray*}
3251and let us check that
3252\begin{eqnarray*}
3253\left \vert \delta^\prime \right \vert
3254& = & \left \vert x_\lo \right \vert \\
3255& < & \left \vert t_2 \right \vert \\
3256& = & \left \vert \xi\left(\hat{x}\right) \right \vert
3257\end{eqnarray*}
3258We can now apply lemma \ref{arrdirper} and obtain:
3259$$\diamond \left( t_1 + t_3 \right) = \diamond \left( x_\hi + x_\mi + x_\lo \right)$$
3260This is the equation to be shown.\qed
3261\end{proof}
3262\begin{theorem}[Directed final rounding of a triple-double number] \label{arrdir} ~ \\
3263Let be $x_\hi + x_\mi + x_\lo \in \F + \F + \F$ a non-overlapping triple-double number. \\
3264Let be $\diamond$ a directed rounding mode.\\
3265Let be {\bf A} the following instruction sequence:
3266\begin{center}
3267\begin{minipage}[b]{50mm}
3268$\left( t_1, t_2 \right) \gets \mAdd\left( x_\hi, x_\mi \right)$ \\
3269$t_3 \gets t_2 \oplus x_\lo$ \\
3270{\bf return } $\diamond\left( t_1 + t_3 \right)$
3271\end{minipage}
3272\end{center}
3273So {\bf A} is a correct rounding procedure for the rounding mode $\diamond$.
3274\end{theorem}
3275\begin{proof} ~\\
3276Trivial as per lemmas \ref{moinsquunmiulp} and \ref{plusdunmiulp}.\qed
3277\end{proof}
3278\bibliographystyle{plain}
3279\bibliography{elem-fun.bib}
3280\end{document}