summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2013-06-07 08:09:04 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2013-06-07 08:09:04 +0000
commite485a28cb45c7821c9b1c4fc3a0767e8af060da8 (patch)
tree99fabd121796f89762f37e7c57b04da5ef309b8f /doc
parent0692363a2aef4ae6900d459f7571467dfd75408b (diff)
downloadmpfr-e485a28cb45c7821c9b1c4fc3a0767e8af060da8.tar.gz
[doc/algorithms.tex] Slightly improved a bound under which mpfr_hypot
cannot have an internal underflow, thus is correct. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8590 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'doc')
-rw-r--r--doc/algorithms.tex14
1 files changed, 8 insertions, 6 deletions
diff --git a/doc/algorithms.tex b/doc/algorithms.tex
index af69f5236..318e906e5 100644
--- a/doc/algorithms.tex
+++ b/doc/algorithms.tex
@@ -2407,7 +2407,7 @@ representable with $p_z$ bits of precision.
When none of the above conditions are satisfied, we use the following
algorithm, whose precision is guaranteed when
-$\Exp(x) - \Exp(y) \leq e_{max} - 2$:
+$\Exp(x) - \Exp(y) \leq e_{max} - 1$:
\begin{quote}
Algorithm {\tt hypot\_1}\\
@@ -2433,7 +2433,7 @@ exponents by $s = \lfloor\frac{e_{max}-1}{2}\rfloor - \Exp(x)$ before
computing squares and shift back the output's exponent by $-s$ using the fact
that $\sqrt{(x.2^s)^2+(y.2^s)^2}/2^s = \sqrt{x^2+y^2}$. We show below that
overflow cannot occur, and underflow cannot occur either when
-$\Exp(x) - \Exp(y) \leq e_{max} - 2$.
+$\Exp(x) - \Exp(y) \leq e_{max} - 1$.
We check first that the exponent shift does not cause overflow and, in the
same time, that the squares of the shifted inputs never overflow.
@@ -2445,10 +2445,12 @@ and $y_s^2$ do not overflow.
Secondly, let us see that the exponent shift does not cause underflow. For
$x$, we know that $0 \leq \Exp(x) + s$, thus neither $x_s$ nor $x_s^2$
-underflows. For $y$, the condition $\Exp(x) - \Exp(y) \leq e_{max} - 2$
-ensures that $e_{min}/2 = -e_{max}/2 \leq \Exp(y) + s$, which shows that
-$y_s$ and its square do not underflow (even when taking the rounding
-into account since the scaling is exact).
+underflows. For $y$, the condition $\Exp(x) - \Exp(y) \leq e_{max} - 1$
+implies that $\lfloor(e_{max}-1)/2\rfloor - s - \Exp(y) \leq e_{max} - 1$,
+and since $e_{max}/2-1 \leq \lfloor(e_{max}-1)/2\rfloor$, we deduce
+$e_{min}/2 = -e_{max}/2 \leq \Exp(y) + s$, which shows that $y_s$ and
+its square do not underflow (even when taking the rounding into account
+since the scaling is exact).
Thirdly, the addition does not overflow because $u + v < 2 x_s^2$ and it was
shown above that $\Z(x_s^2) < 2^{e_{max} - 1}$. It cannot underflow because