summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2009-05-05 17:13:37 +0000
committerthevenyp <thevenyp@280ebfd0-de03-0410-8827-d642c229c3f4>2009-05-05 17:13:37 +0000
commitc2c555787ea9185aa57937173d51b1127259c75a (patch)
tree5421c2d7151148ca42f8681c1ad882a8993e06b8
parent9142c178b36633b01c2b457d47ef8ca436c801cb (diff)
downloadmpfr-c2c555787ea9185aa57937173d51b1127259c75a.tar.gz
Put '#include <string.h>' in mpfr-impl.h, remove it elsewhere.
Other cleanup of header inclusion. Other change (by mistake): corrections in algorithms.tex git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6192 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--algorithms.tex14
-rw-r--r--dump.c2
-rw-r--r--get_d64.c1
-rw-r--r--get_str.c2
-rw-r--r--mpfr-impl.h2
-rw-r--r--out_str.c2
-rw-r--r--printf.c1
-rw-r--r--set_d.c1
-rw-r--r--strtofr.c1
-rw-r--r--swap.c2
-rw-r--r--tests/tests.c2
-rw-r--r--tests/tget_str.c2
-rw-r--r--tests/tout_str.c2
-rw-r--r--tests/toutimpl.c2
-rw-r--r--tests/tpow_all.c3
-rw-r--r--tests/trint.c2
-rw-r--r--tests/tset_str.c3
-rw-r--r--tests/tsin.c2
-rw-r--r--tests/tsprintf.c7
-rw-r--r--tests/tstckintc.c3
-rw-r--r--tests/tstrtofr.c3
-rw-r--r--tests/tversion.c2
-rw-r--r--vasprintf.c2
23 files changed, 9 insertions, 54 deletions
diff --git a/algorithms.tex b/algorithms.tex
index 474a18455..02b467db2 100644
--- a/algorithms.tex
+++ b/algorithms.tex
@@ -2043,7 +2043,7 @@ x=\sum_{i=1}^{\infty} \frac{u_i}{2^i}\;\;\mbox{with}\;\;u_i\in\{0,1\}
\end{equation*}
or
\begin{equation*}
-x=\sum_{i=1}^{\infty} \frac{u_i}{2^{2^i}}\;\;\mbox{with}\;\;u_i\in\{0,1,\dots,2^{2^{i-1}}_1\}\mbox{~if~}i>1\mbox{~and~}u_1\in \{0,1\}
+x=\sum_{i=1}^{\infty} \frac{u_i}{2^{2^i}}\;\;\mbox{with}\;\;u_i\in\{0,1,\dots,2^{2^{i-1}}\}\mbox{~if~}i>1\mbox{~and~}u_1\in \{0,1\}
\end{equation*}
we can compute $\cos$, $\sin$ or $\exp$ using the formulas
\begin{equation*}
@@ -2098,7 +2098,7 @@ the number $s_N$ is decreasing toward $0$ and we then have
\end{enumerate}
The drawbacks of this algorithm are:
\begin{enumerate}
-\item Complexity of the process is high, higher than the AGM. Nevertheless there is some hope that this can be more efficient than AGM is the domain where the number of bits is high but not too large.
+\item Complexity of the process is high, higher than the AGM. Nevertheless there is some hope that this can be more efficient than AGM in the domain where the number of bits is high but not too large.
\item There is the need for division which is computationally expensive.
\item We may have to compute $\arctan\,(1/2)$.
\end{enumerate}
@@ -2149,7 +2149,7 @@ We need to estimate all the quantities involved in the computation.
&\leq &\sum_{i=N_0}^{\infty}\frac{1}{2^{2^i}}=\frac{c_{N_0}}{2^{2^{N_0}}}
\end{eqnarray*}
With $c_{N_0}\leq 1.64$. If $N_0\geq 1$ then $c_{N_0}\leq 1.27$. If $N_0\geq 2$ then $c_{N_0}\leq 1.07$.\\
-It remains to determine the good $N_0$.
+It remains to determine the right $N_0$.
\item The partial sum of the Taylor series for $\arctan$ have derivative bounded by $1$ and consequently don't increase error.
\item The error created by using the partial sum of the Taylor series of $\arctan$ is bounded by
\begin{equation*}
@@ -2174,11 +2174,11 @@ In total this is $(N_0) ulp$.
\item The total sum of errors is then (if no errors are done in the counting of errors)
\begin{eqnarray*}
Err(\arctan)
-&=&\sum_{i=0}^{i=N_0}\frac{1}{2*2^{m_i}+1}2^{-2^{i+m_i}}+\frac{2}{2^{2^{N_0}}}+(N_0-1)2^{-Prec}\\
+&=&\sum_{i=0}^{i=N_0}\frac{1}{2*2^{m_i}+1}2^{-2^{i+m_i}}+\frac{c_{N_0}}{2^{2^{N_0}}}+(N_0-1)2^{-Prec}\\
&+&(N_0 -1)2^{-Prec}+(N_0)2^{-Prec}\;\;\;[m_i=N_0-i]\\
-&=&\sum_{i=0}^{i=N_0}\frac{1}{2*2^{N_0-i}+1}2^{-2^{N_0}}+\frac{2}{2^{2^{N_0}}}+(3*N_0-2)2^{-Prec}\\
-&=&\sum_{i=0}^{i=N_0}\frac{1}{2*2^{i}+1}2^{-2^{N_0}}+\frac{2}{2^{2^{N_0}}}+(3*N_0-2)2^{-Prec}\\
-&\leq &\{\sum_{i=0}^{i=\infty}\frac{1}{2*2^{i}+1}\}2^{-2^{N_0}}+\frac{2}{2^{2^{N_0}}}+(3*N_0-2)2^{-Prec}\\
+&=&\sum_{i=0}^{i=N_0}\frac{1}{2*2^{N_0-i}+1}2^{-2^{N_0}}+\frac{c_{N_0}}{2^{2^{N_0}}}+(3*N_0-2)2^{-Prec}\\
+&=&\sum_{i=0}^{i=N_0}\frac{1}{2*2^{i}+1}2^{-2^{N_0}}+\frac{c_{N_0}}{2^{2^{N_0}}}+(3*N_0-2)2^{-Prec}\\
+&\leq &\{\sum_{i=0}^{i=\infty}\frac{1}{2*2^{i}+1}\}2^{-2^{N_0}}+\frac{c_{N_0}}{2^{2^{N_0}}}+(3*N_0-2)2^{-Prec}\\
&\leq&\{0.77\}2^{-2^{N_0}}+\frac{1.63}{2^{2^{N_0}}}+(3*N_0-2)2^{-Prec}\\
&=&\frac{2.4}{2^{2^{N_0}}}+(3*N_0-2)2^{-Prec}
\end{eqnarray*}
diff --git a/dump.c b/dump.c
index 3eec0c0f4..e4015eb20 100644
--- a/dump.c
+++ b/dump.c
@@ -20,8 +20,6 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <string.h>
-
#include "mpfr-impl.h"
void
diff --git a/get_d64.c b/get_d64.c
index 8410ee988..2855f4d2d 100644
--- a/get_d64.c
+++ b/get_d64.c
@@ -26,7 +26,6 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <stdlib.h> /* for strtol */
-#include <string.h> /* for strcmp */
#include "mpfr-impl.h"
#define ISDIGIT(c) ('0' <= c && c <= '9')
diff --git a/get_str.c b/get_str.c
index f3261a961..eefd652dc 100644
--- a/get_str.c
+++ b/get_str.c
@@ -21,8 +21,6 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <string.h> /* For strlen */
-
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
diff --git a/mpfr-impl.h b/mpfr-impl.h
index cf158d06b..b3832e436 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -33,8 +33,10 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
also force to disable incompatible features). */
#if defined (__cplusplus)
#include <cstdio>
+#include <cstring>
#else
#include <stdio.h>
+#include <string.h>
#endif
#include <limits.h>
diff --git a/out_str.c b/out_str.c
index c61344702..013fd3e35 100644
--- a/out_str.c
+++ b/out_str.c
@@ -20,8 +20,6 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <string.h>
-
#include "mpfr-impl.h"
size_t
diff --git a/printf.c b/printf.c
index bd8f3fdab..c78e581f1 100644
--- a/printf.c
+++ b/printf.c
@@ -40,7 +40,6 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
# endif /* HAVE___VA_COPY */
#endif /* HAVE_VA_COPY */
-#include <string.h>
#include <errno.h>
#include "mpfr-impl.h"
diff --git a/set_d.c b/set_d.c
index b6405e782..14da7fe32 100644
--- a/set_d.c
+++ b/set_d.c
@@ -21,7 +21,6 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <string.h> /* For memcmp if _GMP_IEEE_FLOAT == 0 */
#include <float.h> /* For DOUBLE_ISINF and DOUBLE_ISNAN */
#define MPFR_NEED_LONGLONG_H
diff --git a/strtofr.c b/strtofr.c
index d46e6b6d6..0a03c227f 100644
--- a/strtofr.c
+++ b/strtofr.c
@@ -20,7 +20,6 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <string.h> /* For strlen */
#include <stdlib.h> /* For strtol */
#include <ctype.h> /* For isspace */
diff --git a/swap.c b/swap.c
index 83381f570..8ff60fa1a 100644
--- a/swap.c
+++ b/swap.c
@@ -20,8 +20,6 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <string.h>
-
#include "mpfr-impl.h"
/* Using memcpy is a few slower than swapping by hand. */
diff --git a/tests/tests.c b/tests/tests.c
index 7d5d55444..0f3875754 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -26,9 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
# endif
#endif
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include <float.h>
#include <errno.h>
diff --git a/tests/tget_str.c b/tests/tget_str.c
index 9c4021cde..4e023fa81 100644
--- a/tests/tget_str.c
+++ b/tests/tget_str.c
@@ -20,9 +20,7 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include "mpfr-test.h"
diff --git a/tests/tout_str.c b/tests/tout_str.c
index cf261cb7c..e01b4faa5 100644
--- a/tests/tout_str.c
+++ b/tests/tout_str.c
@@ -21,9 +21,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <float.h>
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include "mpfr-test.h"
diff --git a/tests/toutimpl.c b/tests/toutimpl.c
index 043aa3aa4..b15685e41 100644
--- a/tests/toutimpl.c
+++ b/tests/toutimpl.c
@@ -22,8 +22,6 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
#include "mpfr-test.h"
/* We output stdout to a file to check if it is correct
diff --git a/tests/tpow_all.c b/tests/tpow_all.c
index 3ceba66ed..a2ba5f569 100644
--- a/tests/tpow_all.c
+++ b/tests/tpow_all.c
@@ -29,10 +29,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
/* Execute with at least an argument to report all the errors found by
comparisons. */
-#include <string.h>
-#include <stdio.h>
#include <stdlib.h>
-#include <limits.h>
#include "mpfr-test.h"
diff --git a/tests/trint.c b/tests/trint.c
index 3b6be4516..f99d03298 100644
--- a/tests/trint.c
+++ b/tests/trint.c
@@ -20,9 +20,7 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include "mpfr-test.h"
diff --git a/tests/tset_str.c b/tests/tset_str.c
index 388f7d64c..f5c2d1883 100644
--- a/tests/tset_str.c
+++ b/tests/tset_str.c
@@ -20,10 +20,7 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
#include "mpfr-test.h"
diff --git a/tests/tsin.c b/tests/tsin.c
index df662d503..86ec8dfd1 100644
--- a/tests/tsin.c
+++ b/tests/tsin.c
@@ -20,9 +20,7 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h> /* for strlen */
#include "mpfr-test.h"
diff --git a/tests/tsprintf.c b/tests/tsprintf.c
index 582708dee..ca1e74c56 100644
--- a/tests/tsprintf.c
+++ b/tests/tsprintf.c
@@ -22,14 +22,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#ifdef HAVE_STDARG
#include <stdarg.h>
-#if defined (__cplusplus)
-#include <cstdio>
-#else
-#include <stdio.h>
-#endif
-
#include <stdlib.h>
-#include <string.h>
#include <float.h>
#ifdef HAVE_LOCALE_H
diff --git a/tests/tstckintc.c b/tests/tstckintc.c
index 4b26351b1..021a38bd1 100644
--- a/tests/tstckintc.c
+++ b/tests/tstckintc.c
@@ -20,10 +20,7 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <stdio.h>
#include <stdlib.h>
-#include <limits.h>
-#include <string.h>
#include "mpfr-test.h"
diff --git a/tests/tstrtofr.c b/tests/tstrtofr.c
index 3e06fe402..2a2071534 100644
--- a/tests/tstrtofr.c
+++ b/tests/tstrtofr.c
@@ -20,10 +20,7 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
#include "mpfr-test.h"
diff --git a/tests/tversion.c b/tests/tversion.c
index 3b822249c..8922a3939 100644
--- a/tests/tversion.c
+++ b/tests/tversion.c
@@ -20,9 +20,7 @@ along with the GNU MPFR Library; see the file COPYING.LIB. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
-#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include "mpfr-test.h"
diff --git a/vasprintf.c b/vasprintf.c
index 3f61a3aa3..d047493b0 100644
--- a/vasprintf.c
+++ b/vasprintf.c
@@ -60,8 +60,6 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
# endif
#endif
-#include <string.h> /* for strlen, memcpy and others */
-
#include "mpfr-impl.h"
/* Define a length modifier corresponding to mp_prec_t.