summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@280ebfd0-de03-0410-8827-d642c229c3f4>2004-11-03 15:19:59 +0000
committer(no author) <(no author)@280ebfd0-de03-0410-8827-d642c229c3f4>2004-11-03 15:19:59 +0000
commit51637611d5c2aab138756377c8d5947875d128b0 (patch)
tree712ea03d548590c56b4254f3ec9177e1dd641836
parent0fa7e68d2efda499aa0e2d73d21c2d0733082611 (diff)
downloadmpfr-51637611d5c2aab138756377c8d5947875d128b0.tar.gz
This commit was manufactured by cvs2svn to create tagmpfr-2-1-0-rel
'mpfr-2-1-0-rel'. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/tags/mpfr-2-1-0-rel@3073 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--AUTHORS7
-rw-r--r--BUGS11
-rw-r--r--ChangeLog365
-rw-r--r--INSTALL23
-rw-r--r--NEWS8
-rw-r--r--README6
-rw-r--r--README.dev34
-rw-r--r--acinclude.m49
-rw-r--r--configure.in4
-rw-r--r--mpfr-impl.h17
-rw-r--r--mpfr-test.h10
-rw-r--r--mpfr.h2
-rw-r--r--mpfr.texi287
-rw-r--r--mul.c2
-rw-r--r--set_d.c1
-rw-r--r--set_str.c17
-rw-r--r--strtofr.c365
-rw-r--r--tests/Makefile.in920
-rw-r--r--tests/mpf_compat.h25
-rw-r--r--tests/tacos.c8
-rw-r--r--tests/tadd1sp.c59
-rw-r--r--tests/tasin.c8
-rw-r--r--tests/tatan.c8
-rw-r--r--tests/tcos.c8
-rw-r--r--tests/tcosh.c8
-rw-r--r--tests/tdiv.c8
-rw-r--r--tests/tests.c46
-rw-r--r--tests/texceptions.c8
-rw-r--r--tests/texp.c16
-rw-r--r--tests/texp2.c16
-rw-r--r--tests/tgamma.c8
-rw-r--r--tests/tinp_str.c3
-rw-r--r--tests/tlog.c8
-rw-r--r--tests/tmul.c8
-rw-r--r--tests/tmul_ui.c4
-rw-r--r--tests/tout_str.c7
-rw-r--r--tests/trandom.c4
-rw-r--r--tests/trint.c4
-rw-r--r--tests/tround_prec.c4
-rw-r--r--tests/tset.c4
-rw-r--r--tests/tset_exp.c4
-rw-r--r--tests/tset_ld.c4
-rw-r--r--tests/tset_si.c14
-rw-r--r--tests/tset_str.c35
-rw-r--r--tests/tset_z.c12
-rw-r--r--tests/tstrtofr.c2
-rw-r--r--tests/tsub1sp.c633
-rw-r--r--tests/ttanh.c8
48 files changed, 1331 insertions, 1741 deletions
diff --git a/AUTHORS b/AUTHORS
index 4f0497a82..d23e692ee 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -9,10 +9,9 @@ Mathieu Dutour asin.c, atan.c and gamma.c
Vincent Lefèvre Main author
David Daney Hyperbolic and inverse hyperbolic functions, base-2
and base-10 exponential and logarithm, factorial
-Patrick Pélissier Working on low-precision optimizations
-Laurent Fousse Original version of sum.c.
+Patrick Pélissier Main author
+Laurent Fousse Original version of sum.c
All authors are included in the MPFR mailing-list <mpfr@loria.fr>.
This is the preferred way to contact us. For further information, please
-look at the MPFR web page <http://www.mpfr.org/> or
-<http://www.loria.fr/projets/mpfr/>.
+look at the MPFR web page <http://www.mpfr.org/>.
diff --git a/BUGS b/BUGS
index edb69016d..8021e4e4b 100644
--- a/BUGS
+++ b/BUGS
@@ -1,4 +1,4 @@
-Copyright 1999, 2001, 2002, 2003 Free Software Foundation.
+Copyright 1999, 2001, 2002, 2003, 2004 Free Software Foundation.
Contributed by the Spaces project, INRIA Lorraine.
This file is part of the MPFR Library.
@@ -24,13 +24,16 @@ Probably many bugs.
Known bugs:
-* The overflows/underflows are not yet implemented in all functions, or
- partially implemented. For instance, mpfr_pow (z, x, y, rnd) fails for
- very small x and some values of y.
+* The overflows/underflows are partially implemented in some functions.
+ For instance, mpfr_pow (z, x, y, rnd) fails for very small x and some
+ values of y.
* The mpfr_set_ld function assumes that the long double type has an
exponent of at most 15 bits.
+* When MPFR is compiled with Visual C++ under MS Windows, some tests may
+ fail, because of the way special IEEE-754 double values are tested.
+
Potential bugs:
* Possible integer overflows on some machines. Some types are used
diff --git a/ChangeLog b/ChangeLog
index d608feb2b..1fa9d8945 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,368 @@
+2004-11-03 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr.texi: Updated month: October -> November (2.1 branch).
+
+ * configure.in:
+ [2.1 branch] Modified an error message, since the code checking for
+ GMP library hadn't been modified in the branch.
+
+2004-10-27 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * acinclude.m4: Updated copyright line.
+
+ * BUGS: Added a bug and updated copyright line.
+
+ * mpfr-impl.h, set_d.c:
+ Removed the definitions of DBL_POS_INF/DBL_NEG_INF/DBL_NAN for
+ Visual C++ as they were incorrect. Modified DOUBLE_ISINF(x) so
+ that infinities are no longer used (this should fix a part of
+ the problem for Visual C++). If IEEE 754 is not supported, one
+ should probably use the standard INFINITY macro instead of
+ (1.0/0.0), since (1.0/0.0) is specific to IEEE 754.
+
+ * acinclude.m4, tests/tests.c:
+ Applied patch by Steve M. Robbins for non-IRIX MIPS systems
+ (originally for MPFR 2.0.3).
+
+2004-10-26 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * tests/tadd1sp.c, tests/tsub1sp.c: Reformatted the code.
+
+ * tests/tsub1sp.c, tests/ttanh.c, tests/tset_ld.c, tests/tset_si.c, tests/tset_str.c, tests/tset_z.c, tests/tround_prec.c, tests/tset.c, tests/tset_exp.c, tests/trint.c, tests/trandom.c, tests/tlog.c, tests/tmul.c, tests/tmul_ui.c, tests/texp2.c, tests/tgamma.c, tests/tcosh.c, tests/tdiv.c, tests/tests.c, tests/texceptions.c, tests/texp.c, tests/tcos.c, tests/tacos.c, tests/tadd1sp.c, tests/tasin.c, tests/tatan.c, mpfr-test.h:
+ Replaced mpfr_set_emin/emax by set_emin/emax in tests to check
+ the return value; defined set_emin/emax in "tests/tests.c".
+ Fix: added missing #include <string.h> in "tests/tests.c".
+ Removed variable names in prototypes in "mpfr-test.h".
+
+2004-10-22 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * tests/mpf_compat.h: Reformatted the code -> GNU style.
+
+ * ChangeLog: Update.
+
+2004-10-22 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * tests/tests.c:
+ Declaration of "tests_rand_start" and "tests_rand_end" with the same storage class specifier
+ in tests.c (static missing line 65 and 109).
+
+2004-10-21 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * strtofr.c:
+ Bug fixed: cast to unsigned char instead of int for isspace (no,
+ these are not "psycho" systems, just systems with signed chars).
+ Untabified the source.
+
+2004-10-20 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * configure.in: Improve ICC CFLAGS by removins meaningless warnings.
+
+ * strtofr.c: Remove some warnings on some "psycho" systems.
+
+ * README.dev: Update the chapter "Make a release".
+
+ * mpfr-test.h, tests/mpf_compat.h, tests/tests.c, tests/tinp_str.c:
+ Fix bug when you build MPFR outside source directory.
+ Add function src_fopen to open a file in the source directory, which
+ may be different from the current directory.
+
+ * INSTALL: Fix a typo.
+
+2004-10-19 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr.texi: Another correction (English).
+
+ * mpfr.texi: Minor correction.
+
+2004-10-19 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * NEWS: Update NEWS to reflect the change in mpfr_set_str.
+
+ * mpfr.texi, set_str.c, tests/tset_str.c:
+ Update mpfr_set_str to be much more like strtofr.
+ Update the documentation to reflect the changes.
+
+2004-10-19 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * mpfr.texi: changed contributors section
+
+2004-10-19 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * NEWS: Add a line about binary compatibility.
+
+2004-10-19 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * mpfr.texi: changed "contributors" section
+
+ * mul.c: changed rights (remove executable permission)
+
+2004-10-18 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr.texi: Misc corrections:
+ + spelling mistakes
+ + consistency: in direction @var{rnd} -> in the direction @var{rnd}
+ + @code{NULL} pointer -> null pointer (as in the C standard)
+ + in the example for mpfr_inits2 / mpfr_clears: NULL -> (void *) 0
+ as NULL isn't necessarily a pointer.
+
+2004-10-18 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * BUGS, README: Update
+
+ * tests/tstrtofr.c, set_str.c, strtofr.c, tests/tset_str.c, mpfr.h, mpfr.texi:
+ Change "unsigned int" to "int" for base in proto of strtofr.
+ Change set_str to use strtofr (Fix a bug too).
+ Limit base to 36 in strtofr (since get_str is limited to 36).
+ Update documentation to reflect the changes.
+ mpfr_get_d1 is moved to section internal in the documentation.
+ Update the tests.
+
+ * mpfr-impl.h: Hard code NAN, +INF and -INF values for MVC.
+
+ * tests/mpf_compat.h, tests/tout_str.c:
+ Fix problem on systems where "/dev/null" doesn't exist.
+
+2004-10-16 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * AUTHORS, mpfr.texi: Misc corrections.
+
+2004-10-15 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * README.dev: Updated the section "To make a release".
+
+ * ChangeLog: Update.
+
+ * NEWS: Update for 2.1.0.
+
+2004-10-13 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * README.dev:
+ Added a comment about autoreconf and a bug in Debian (now fixed).
+
+2004-10-12 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * INSTALL: Add a note about Windows 64.
+
+2004-10-11 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * mpfr.texi: Update documentation.
+
+ * INSTALL: Improve Windows installation.
+
+ * README.dev: Add a line about "near" and "far".
+
+2004-10-07 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * acinclude.m4, configure.in, tests/tget_str.c:
+ Add support for ".lib" since it seems to work.
+ Display GMP version inside the configure.
+
+2004-10-05 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * tests/tget_str.c: added one new test
+
+2004-10-04 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * tests/tget_str.c: Added worst cases.
+
+2004-10-02 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * tests/tset_str.c: added new tests (worst-case)
+
+2004-10-01 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * tests/tget_str.c: added new worst-cases (directed rounding)
+
+ * TODO: added new function to implement (dilog)
+
+2004-09-30 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * get_str.c: fixed bug in get_str_aux when one extra digit
+
+2004-09-30 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr.h, mpfr.texi, rint.c, tests/trint.c:
+ Added functions mpfr_rint_round, mpfr_rint_trunc, mpfr_rint_ceil,
+ mpfr_rint_floor.
+
+2004-09-30 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * tests/tget_str.c: Add new test (One failed).
+
+2004-09-30 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * get_sj.c:
+ The cast to uintmax_t wasn't really useful, so I removed it.
+ Added a comment.
+
+ * get_sj.c: The real fix for sizeof(intmax_t) == sizeof(mp_limb_t).
+
+2004-09-30 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * get_sj.c: Fix a bug if sizeof(intmax_t) == sizeof(mp_limb_t)
+
+2004-09-29 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * tests/tget_str.c: added worst-case
+
+2004-09-29 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * TODO, cmp.c, cmp_abs.c, cmp_d.c, cmp_si.c, cmp_ui.c, mpfr.texi, tests/tcmp.c, tests/tcmp_d.c, tests/tcmp_ld.c, tests/tcmp_ui.c, tests/tcmpabs.c:
+ cmp(x,y) if x=NAN or y=NAN returns 0 and erange flag.
+
+ * NEWS, mpfr.texi:
+ Update documentation and NEWS to reflect new functions
+ and functionnality.
+
+ * get_z.c, strtofr.c: Improve assertion.
+
+ * tests/tset_si.c, exceptions.c, get_si.c, get_sj.c, get_ui.c, get_uj.c, mpfr-impl.h, set_sj.c, set_uj.c, tests/texceptions.c, tests/tget_sj.c, tests/tset_sj.c:
+ Add mpfr_clear_erangeflag and mpfr_erangeflag_p.
+ Add test for theses two functions.
+ mpfr_get_[s/u][i/j] have a deterministic behavior in case of OVERFLOW.
+ (Return the MINIMUM or the MAXIMUM in the current type, and set
+ ERANGE_flag).
+
+ * Makefile.am, fits_intmax.c, fits_uintmax.c, mpfr.h, tests/tfits.c:
+ Add mpfr_uintmax_p and mpfr_intmax_p.
+
+ * TODO, INSTALL: Update INSTALL about C++
+ Update TODO and VERSION.
+
+ * mpfr-impl.h, mpfr.texi, mpfr.h:
+ Move mpfr_inits from mpfr-impl to mpfr.h.
+ Add doc too.
+
+2004-09-28 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * get_sj.c, get_uj.c: Reindent the sources (again).
+
+ * mpn_exp.c:
+ Fix how to detect overflow so that it can be build with GCC -ftrapv
+ option without any bugs (In the previous code, the overflow was
+ detected afterwards, whereas, now, it is detected before).
+ Fix also another real problem of overflow (Addition of two signed integers).
+
+ * div.c: Rename this variable again.
+
+ * div.c:
+ Replace variable 'near' to 'the_real_near' since MSVC incorreclty
+ recognize "far" and "near" as obsolete keywords (100% incorrect, and
+ clearly MSVC fault but it doesn't cost many things to change the name).
+
+2004-09-27 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * mpfr.texi: Fix typo in the documentation about get_ functions.
+
+ * get_sj.c, get_uj.c: Retab the sources.
+
+2004-09-27 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * NEWS:
+ Added mpfr_get_uj and mpfr_get_sj in the changes 2.0.3 -> 2.1.0.
+
+ * TODO: Added an item about the future MPFR_FLAGS_ERANGE flag.
+
+ * Makefile.am, get_sj.c, get_uj.c, mpfr.h, mpfr.texi, tests/Makefile.am, tests/tget_sj.c:
+ New functions mpfr_get_sj and mpfr_get_uj, with tests.
+
+2004-09-27 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * set_sj.c: Remove MPFR_NEED_LONGLONG_H macro.
+
+2004-09-26 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * set_sj.c: Added a cast to avoid an integer overflow.
+
+2004-09-24 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * get_si.c: Fixed integer overflow.
+
+ * get_si.c: Fixed bugs (like those in mpfr_get_ui).
+
+ * README.dev:
+ The standard autoreconf script should now be used instead of prepare.
+
+2004-09-24 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * get_ui.c: forgot to check for 0
+
+ * get_ui.c: now use mpfr_rint()
+
+2004-09-24 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * mpfr.texi: Update doc of mpfr_get_str (Minimum space is 7).
+
+2004-09-24 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * get_ui.c, tests/tset_si.c: fixed double-rounding bug in get_ui
+
+2004-09-23 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * mpf2mpfr.h: Prevent from multiple inclusion.
+ mpf_init inits to 0 rather than NAN.
+
+ * mpfr.h: Fix some tiny problems.
+
+2004-09-23 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * TODO: added item on rounding to odd
+
+2004-09-21 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * strtofr.c: Fix a bug in FreeBsd 5.20 / Alpha / Gcc 3.3.3.
+ Nor a MPFR bug, but add some code to avoid it.
+
+ * strtofr.c, tests/tstrtofr.c: Add a new test and clarify a comment.
+
+ * strtofr.c: Update Assertion for pow2.
+
+2004-09-20 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * NEWS: Update NEWS.
+
+ * TODO: Update TODO due to new function mpfr_strtofr
+
+ * configure.in, get_d.c, mpfr-impl.h, mpfr.h, set_d.c, strtofr.c, tests/memory.c, tests/tdiv.c, tests/tests.c, tests/tget_str.c, tests/trint.c, tests/tset_d.c, tests/tset_q.c, tests/tset_str.c, tests/tstrtofr.c:
+ Add ICC detection && support.
+ Remove some potential warnings in the test files.
+
+ * Makefile.am, mpfr.texi, strtofr.c, tests/Makefile.am, tests/tstrtofr.c:
+ Add mpfr_strtofr function.
+ Add mpfr_strtofr test file.
+ Add mpfr_strtofr documentation.
+
+ * configure.in: Improve GMP.h vs libgmp.a version checking.
+
+2004-09-17 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * TODO: added one entry (new function 1/sqrt(x))
+
+2004-09-17 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * acinclude.m4, configure.in, tests/Makefile.am:
+ Use LIBS instead of LDADD for libraries (GMP).
+
+ * configure.in: Min GMP version is 4.1.0 now.
+
+2004-09-16 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * configure.in:
+ Add a check if both gmp.h and libgmp.a have the same version.
+
+ * mpfr-impl.h: Fix a typo.
+
+2004-09-15 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * tests/tset_str.c: Add a forgotten regression test "1.2.3"
+
+2004-09-15 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * config.sub, config.guess:
+ Update from the autotools-dev Debian package.
+
+ * ChangeLog: Update.
+
2004-09-14 Patrick Pelissier <Patrick.Pelissier@loria.fr>
* mpfr-impl.h: Add 2 new macros for handling correctly overflow.
diff --git a/INSTALL b/INSTALL
index 8866341d1..092816f01 100644
--- a/INSTALL
+++ b/INSTALL
@@ -33,7 +33,7 @@ install recent versions of some utilities such as texinfo.
Building MPFR with internal GMP header files
============================================
- MPFR built with internal GMP header files is a few faster,
+ MPFR built with internal GMP header files is a bit faster,
so you may want to build it with them. Just do this in step 1:
./configure --with-gmp-build=GMPBUILD
@@ -82,6 +82,8 @@ In case of problem
On some architectures, try with `gmake` instead of `make`.
+ Try to build MPFR with/without GMP internal files.
+
If you can't solve your problem, you could contact us at mpfr@loria.fr,
indicating the machine and operating system used (uname -a), the compiler
and version used (gcc -v if you use gcc), the compile options used if any,
@@ -92,8 +94,8 @@ In case of problem
the test suite: C and C++ are not the same language!
You should use a C compiler instead.
-Notes on Windows
-================
+Notes on Windows 32
+===================
1 - we advise to use mingw (http://www.mingw.org/), which is simpler and
less demanding than cygwin. Contrary to Cygwin, it also provides native
@@ -104,11 +106,22 @@ Notes on Windows
2 - if you just want to make a binary with gcc, there is nothing to do:
gmp, mpfr and the program compile exactly as under Linux.
-3 - if you want to make libraries to work under a native Windows compiler
+3 - if you want to make libraries to work under another Windows compiler
like Visual C / C++, the "trick" is that the unix-like *.a files created
by gcc are entirely compatible with the Windows *.lib files. So you just
have to rename the *.a files into *.lib.
With gmp-4.1.3, the only remaining problem seems to be the "alloca" calls
in gmp. Configuring gmp and mpfr with --enable-alloca=malloc-reentrant
- should work.
+ should work (If you build MPFR with gmp internal files).
+
+ Or you could add the library
+ "$MINGWIN$/lib/gcc-lib/mingw32/$VERSION$/libgcc.a"
+ to your project: it contains all the extra-functions needed by a program
+ compiled by GCC (Division of 64 bits integer, bcopy, alloca, ...).
+ Of course, include it iff your compiler is not GCC.
+
+Notes on Windows 64
+===================
+
+ MPFR has not been tested on Windows 64.
diff --git a/NEWS b/NEWS
index 5844ba94d..e0609937f 100644
--- a/NEWS
+++ b/NEWS
@@ -30,7 +30,8 @@ Changes from version 2.0.3 to version 2.1.0:
mpfr_get_default_rounding_mode, mpfr_get_emin_min, mpfr_get_emin_max,
mpfr_get_emax_min, mpfr_get_emax_max, mpfr_inits, mpfr_inits2, mpfr_clears,
mpfr_fits_intmax_p, mpfr_fits_uintmax_p, mpfr_clear_erangeflag,
- mpfr_erangeflag_p.
+ mpfr_erangeflag_p, mpfr_rint_round, mpfr_rint_trunc, mpfr_rint_ceil,
+ mpfr_rint_floor.
- new macros MPFR_DECL_INIT, MPFR_VERSION, MPFR_VERSION_NUM,
MPFR_VERSION_MAJOR, MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL.
- improved documentation.
@@ -39,7 +40,10 @@ Changes from version 2.0.3 to version 2.1.0:
- It handles correctly non IEEE-754 double.
- GMP internal files are not needed to install MPFR.
- It is faster with low-precision floatting point.
-- New global flag: ERANGE_FLAG
+- New global flag: ERANGE_FLAG.
+- Binary incompatible with previous versions, but API compatible.
+- mpfr_set_str doesn't allow anymore "@NAN@garbagechar" and "@INF@garbagechar",
+ allows base 0 (detection of the base), prefix (0x, 0b), leading whitespace.
Changes from version 2.0.2 to version 2.0.3:
- Bug fixes.
diff --git a/README b/README
index 2180ce51a..1f11ca010 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Copyright 2000, 2001, 2002, 2003 Free Software Foundation.
+Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation.
Contributed by the Spaces project, INRIA Lorraine.
This file is part of the MPFR Library.
@@ -45,7 +45,6 @@ mkinst* - auxiliary installation file
mpf2mpfr.h - header file for compatibility with MPF
mpfr.h - external header file for MPFR
mpfr-impl.h - internal header file for MPFR
-mpfr-math.h - another internal header file for MPFR
mpfr-test.h - header file for test files
mpfr.info - info file for MPFR
mpfr.texi - texinfo documentation for MPFR
@@ -55,6 +54,7 @@ texinfo.tex - TeX macros to handle mpfr.texi
You can get the latest source code by CVS:
- cvs -d :pserver:cvs@cvs-sop.inria.fr:/CVS/spaces checkout mpfr
+ cvs -d :pserver:cvs@cvs-sop.inria.fr:/CVS/spaces login
+ cvs -d :pserver:cvs@cvs-sop.inria.fr:/CVS/spaces -z3 checkout -P mpfr
(empty password). CVS users should read the file "README.dev".
diff --git a/README.dev b/README.dev
index 4b3ba37cd..80217459b 100644
--- a/README.dev
+++ b/README.dev
@@ -5,8 +5,9 @@ To compile source code obtained from CVS, you need some GNU development
utilities: aclocal, autoheader, automake, autoconf 2.50 (at least). As
some files like "configure" are not part of the CVS repository, you
first need to run "autoreconf"; if you have both autoconf 2.13 and 2.50
-installed, you may need to run "autoreconf" a second time. Then you can
-run "configure" in the usual way (see the INSTALL file).
+installed and use a wrapper, you may need to run "autoreconf" a second
+time (as with old Debian packages, due to a bug in the wrapper). Then
+you can run "configure" in the usual way (see the INSTALL file).
If for some reason, this doesn't work, there's still the old way: run
the "prepare" script to generate these files; as the "prepare" script
@@ -52,21 +53,23 @@ with new systems.
To make a release (for the MPFR team):
1) Check the version and update the date in mpfr.texi.
- 2) Update the ChangeLog file (using a recent version of rcs2log,
+ 2) Update the NEWS file.
+ 3) Update the ChangeLog file (using a recent version of rcs2log,
directly or with emacs), e.g. rcs2log > ChangeLog.2 and edit
ChangeLog to insert ChangeLog.2 at the beginning and remove
the duplicated lines.
- 3) Update the NEWS file.
- 4) Generate the release version with "make dist".
- 5) Test the release version on different machines, with and without
+ 4) Fix the file permissions that have been broken by CVS.
+ 5) Generate the release version with "make dist".
+ 6) Test the release version on different machines, with and without
the --disable-alloca configure option (or compile gmp with
--enable-alloca=debug), with and without -DXDEBUG in $CFLAGS,
with and without gmp internal files, with and without gmp built
- as a shared library.
- 6) If there is no problem, add a tag to the CVS corresponding to the
+ as a shared library, with and without srcdir equals to objdir
+ (../mpfr/configure --srcdir=/users/spaces/pelissip/mpfr/).
+ 7) If there is no problem, add a tag to the CVS corresponding to the
release, e.g. mpfr-2-0-1-rel for mpfr 2.0.1 (note that the periods
are replaced by dashes): cvs tag mpfr-2-0-1-rel
- 7) Update the version with the update-version script to indicate the
+ 8) Update the version with the update-version script to indicate the
next version.
A branch may be created first (e.g. with "cvs tag -b mpfr-2-0-2-branch")
@@ -74,7 +77,7 @@ to allow new features to be committed to the trunk.
===========================================
-To check the coverage of the test suite (for the MPFR team),
+To check the coverage of the test suite (for the MPFR team),
you can use gcov (with GCC):
1. Clean MPFR:
make clean
@@ -91,7 +94,7 @@ you can use gcov (with GCC):
===========================================================================
List of the used macros for building MPFR:
-
+
+ HAVE_STRCASECMP: Define if the system supports 'strcasecmp' function.
+ HAVE_STRNCASECMP: Define if the system supports 'strncasecmp' function.
@@ -111,7 +114,7 @@ List of the used macros for building MPFR:
+ HAVE_LDOUBLE_IEEE_QUAD_BIG: IEEE quad, big endian.
+ XDEBUG: Use generic 'double' code instead of IEEE specific one.
- The IEEE code for double needs GMP internal files.
+ The IEEE code for double needs GMP internal files.
+ WANT_ASSERT: Define if we want to turn on the assertions.
+ MPFR_EXP_CHECK: Define if we want to check the exp field.
@@ -124,7 +127,7 @@ List of the used macros for building MPFR:
List of the used macros for checking MPFR:
-+ MPFR_HAVE_FESETROUND: Define if the fesetround function is defined
++ MPFR_HAVE_FESETROUND: Define if the fesetround function is defined
(and in header fenv.h).
+ HAVE_DENORMS: Define if denormalized floats work.
+ HAVE_SYS_TIME_H: Define if the header sys/time.h is usuable.
@@ -149,3 +152,8 @@ produce illegal codes with the first form.
The GNU Coding standards can be read at:
http://www.gnu.org/prep/standards_toc.html
+
+===========================================================================
+
+Don't use "near" and "far" as variable names since they are "Keywords"
+for some C compiler (Old DOS compiler).
diff --git a/acinclude.m4 b/acinclude.m4
index 6a813f205..f5ef1d882 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,6 +1,6 @@
dnl MPFR specific autoconf macros
-dnl Copyright 2000, 2002, 2003 Free Software Foundation.
+dnl Copyright 2000, 2002, 2003, 2004 Free Software Foundation.
dnl Contributed by the Spaces project, INRIA Lorraine.
dnl
dnl This file is part of the MPFR Library.
@@ -151,6 +151,13 @@ esac
#
AC_CHECK_HEADERS(sys/fpu.h)
+AC_CHECK_TYPE( [union fpc_csr], AC_DEFINE(HAVE_FPC_CSR), ,
+[
+#if HAVE_SYS_FPU_H
+# include <sys/fpu.h>
+#endif
+])
+
dnl Check for fesetround
AC_CACHE_CHECK([for fesetround], mpfr_cv_have_fesetround, [
saved_LIBS="$LIBS"
diff --git a/configure.in b/configure.in
index c9eac1c5d..744e34536 100644
--- a/configure.in
+++ b/configure.in
@@ -60,7 +60,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#endif
]], [[]])],[AC_MSG_RESULT(yes)
GCC=
- CFLAGS="-pc64 -fp_port -mp $CFLAGS"
+ CFLAGS="-pc64 -fp_port -mp -wd1572 -wd265 -wd186 -wd239 $CFLAGS"
],[AC_MSG_RESULT(no)])
dnl If compiler is gcc, then use some specific flags.
@@ -176,7 +176,7 @@ int main()
}
], AC_MSG_RESULT(yes),
[AC_MSG_RESULT(no)
- AC_MSG_ERROR(['gmp.h' and 'libgmp' have different versions! you have to properly reinstall GMP.])],
+ AC_MSG_ERROR(['gmp.h' and 'libgmp' have different versions, or (on some platforms) libgmp couldn't be found! You have to properly reinstall GMP.])],
AC_MSG_RESULT([can't test])
)
diff --git a/mpfr-impl.h b/mpfr-impl.h
index 4cc131504..0d2c41124 100644
--- a/mpfr-impl.h
+++ b/mpfr-impl.h
@@ -262,6 +262,16 @@ typedef unsigned long int mpfr_uexp_t;
#endif
#define MPFR_LIMBS_PER_DOUBLE ((IEEE_DBL_MANT_DIG-1)/BITS_PER_MP_LIMB+1)
+/* Visual C++ doesn't support +1.0/.00, -1.0/0.0 and 0.0/0.0
+#if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)
+# define DBL_POS_INF ((double)0x7ff0000000000000ull)
+# define DBL_NEG_INF ((double)0xfff0000000000000ull)
+# define DBL_NAN ((double)0x7ff8000000000000ull)
+#else */
+#define DBL_POS_INF ((double) 1.0/0.0)
+#define DBL_NEG_INF ((double)-1.0/0.0)
+#define DBL_NAN ((double) 0.0/0.0)
+
/* for x of type ieee_double_extract */
#if _GMP_IEEE_FLOATS
typedef union ieee_double_extract Ieee_double_extract;
@@ -274,13 +284,10 @@ typedef union ieee_double_extract Ieee_double_extract;
((((Ieee_double_extract *)&(x))->s.manl != 0) || \
(((Ieee_double_extract *)&(x))->s.manh != 0)))
#else
-# define DOUBLE_ISINF(x) (((x)==((double)+1.0/0.0))||((x)==((double)-1.0/0.0)))
-# define DOUBLE_ISNAN(x) ((x)!=(x))
+# define DOUBLE_ISINF(x) ((x) > DBL_MAX || (x) < -DBL_MAX)
+# define DOUBLE_ISNAN(x) ((x) != (x))
#endif
-#define DBL_POS_INF (1.0/0.0)
-#define DBL_NEG_INF (-1.0/0.0)
-#define DBL_NAN (0.0/0.0)
/* macros for long doubles */
diff --git a/mpfr-test.h b/mpfr-test.h
index 0e021b87d..1b592bf44 100644
--- a/mpfr-test.h
+++ b/mpfr-test.h
@@ -22,6 +22,7 @@ MA 02111-1307, USA. */
#ifndef __MPFR_TEST_H__
#define __MPFR_TEST_H__
+#include <stdio.h>
#include "mpfr-impl.h"
/* generates a random long int, a random double,
@@ -65,7 +66,7 @@ void tests_machine_prec_double _MPFR_PROTO ((void));
void tests_machine_prec_long_double _MPFR_PROTO ((void));
unsigned short x86_fstcw _MPFR_PROTO ((void));
-void x86_fldcw _MPFR_PROTO ((unsigned short cw));
+void x86_fldcw _MPFR_PROTO ((unsigned short));
int mpfr_set_machine_rnd_mode _MPFR_PROTO ((mp_rnd_t));
void mpfr_test_init _MPFR_PROTO ((void));
@@ -78,8 +79,11 @@ int Isnan _MPFR_PROTO ((double));
void d_trace _MPFR_PROTO ((const char *, double));
void ld_trace _MPFR_PROTO ((const char *, long double));
-int mpfr_cmp_str _MPFR_PROTO ((mpfr_srcptr x, const char *s, int base,
- mp_rnd_t rnd));
+FILE *src_fopen _MPFR_PROTO ((const char *, const char *));
+void set_emin _MPFR_PROTO ((mp_exp_t));
+void set_emax _MPFR_PROTO ((mp_exp_t));
+
+int mpfr_cmp_str _MPFR_PROTO ((mpfr_srcptr x, const char *, int, mp_rnd_t));
#define mpfr_cmp_str1(x,s) mpfr_cmp_str(x,s,10,GMP_RNDN)
#define mpfr_set_str1(x,s) mpfr_set_str(x,s,10,GMP_RNDN)
diff --git a/mpfr.h b/mpfr.h
index e0b9a57b3..2a464201e 100644
--- a/mpfr.h
+++ b/mpfr.h
@@ -444,7 +444,7 @@ int mpfr_cache _MPFR_PROTO ((mpfr_ptr, mpfr_cache_t, mpfr_rnd_t));
void mpfr_free_cache _MPFR_PROTO ((void));
int mpfr_strtofr _MPFR_PROTO ((mpfr_ptr, __gmp_const char *, char **,
- unsigned int, mpfr_rnd_t));
+ int, mpfr_rnd_t));
#if defined (__cplusplus)
}
diff --git a/mpfr.texi b/mpfr.texi
index e19184ba3..df3591a23 100644
--- a/mpfr.texi
+++ b/mpfr.texi
@@ -3,7 +3,7 @@
@setfilename mpfr.info
@documentencoding ISO-8859-1
@set VERSION 2.1.0
-@set UPDATED-MONTH August 2004
+@set UPDATED-MONTH November 2004
@settitle MPFR @value{VERSION}
@synindex tp fn
@iftex
@@ -446,7 +446,7 @@ of a floating-point number;
the corresponding C data type is @code{mp_prec_t}.
The precision can be any integer between @code{MPFR_PREC_MIN} and
@code{MPFR_PREC_MAX}. In the current implementation, @code{MPFR_PREC_MIN}
-is equal to 2 and @code{MPFR_PREC_MAX} is equal to @code{ULONG_MAX}/2.
+is equal to 2.
@cindex Rounding Modes
@tindex @code{mp_rnd_t}
@@ -593,6 +593,7 @@ precision, then MPFR will still compute the result with full precision.
* Comparison Functions::
* Special Functions::
* Input and Output Functions::
+* Integer Related Functions::
* Miscellaneous Functions::
* Rounding Modes::
* Exceptions::
@@ -649,7 +650,7 @@ The precision can be any integer between @code{MPFR_PREC_MIN} and
@end deftypefun
@deftypefun mp_prec_t mpfr_get_default_prec (void)
-Returns the default MPFR precision in bits.
+Return the default MPFR precision in bits.
@end deftypefun
@need 2000
@@ -699,7 +700,7 @@ number of bits used to store its mantissa.
These functions assign new values to already initialized floats
(@pxref{Initialization Functions}). When using any functions using
@code{intmax_t}, you must include @code{<stdint.h>} or @code{<inttypes.h>}
-before @file{mpfr.h}, to allow @file{mpfr.h} to define prototypes for
+before @file{mpfr.h}, to allow @file{mpfr.h} to define prototypes for
these functions.
@deftypefun int mpfr_set (mpfr_t @var{rop}, mpfr_t @var{op}, mp_rnd_t @var{rnd})
@@ -715,10 +716,10 @@ these functions.
Set the value of @var{rop} from @var{op}, rounded
towards the given direction @var{rnd}.
Note that the input 0 is converted to +0 by @code{mpfr_set_ui},
-@code{mpfr_set_si}, @code{mpfr_set_sj}, @code{mpfr_set_uj},
+@code{mpfr_set_si}, @code{mpfr_set_sj}, @code{mpfr_set_uj},
@code{mpfr_set_z}, @code{mpfr_set_q} and
@code{mpfr_set_f}, regardless of the rounding mode.
-If the system doesn't support IEEE 754 standard, @code{mpfr_set_d} and
+If the system doesn't support the IEEE-754 standard, @code{mpfr_set_d} and
@code{mpfr_set_ld} might not preserve the signed zeros.
@end deftypefun
@@ -731,33 +732,24 @@ two to the power @var{e}}, rounded towards the given direction @var{rnd}.
Note that the input 0 is converted to +0.
@end deftypefun
-@deftypefun int mpfr_set_str (mpfr_t @var{x}, const char *@var{s}, int @var{base}, mp_rnd_t @var{rnd})
-Set @var{x} to the value of the whole string @var{s} in base @var{base}
-(between 2 and 36), rounded in direction @var{rnd}.
-See the documentation of @code{mpfr_inp_str} for a detailed description
-of the valid string formats.
-This function returns 0 if the entire string up to the final @code{\0} is a
-valid number in base @var{base}; otherwise it returns @minus{}1.
-@end deftypefun
-
-@deftypefun void mpfr_set_inf (mpfr_t @var{x}, int @var{sign})
-@deftypefunx void mpfr_set_nan (mpfr_t @var{x})
-Set the variable @var{x} to infinity or NaN (Not-a-Number) respectively.
-In @code{mpfr_set_inf}, @var{x} is set to plus infinity iff @var{sign} is
-nonnegative.
-@end deftypefun
-
-@deftypefun void mpfr_swap (mpfr_t @var{x}, mpfr_t @var{y})
-Swap the values @var{x} and @var{y} efficiently. Warning: the
-precisions are exchanged too; in case the precisions are different,
-@code{mpfr_swap} is thus not equivalent to three @code{mpfr_set} calls
-using a third auxiliary variable.
+@deftypefun int mpfr_set_str (mpfr_t @var{rop}, const char *@var{s}, int @var{base}, mp_rnd_t @var{rnd})
+Set @var{rop} to the value of the whole string @var{s} in base @var{base},
+rounded in the direction @var{rnd}.
+See the documentation of @code{mpfr_strtofr} for a detailed description
+of the valid string formats.
+@c Additionally, special values
+@c @code{@@NaN@@}, @code{@@Inf@@}, @code{+@@Inf@@} and @code{-@@Inf@@},
+@c all case insensitive, without leading whitespace and possibly followed by
+@c other characters, are accepted too (it may change).
+This function returns 0 if the entire string up to the final null character
+is a valid number in base @var{base}; otherwise it returns @minus{}1, and
+@var{rop} may have changed.
@end deftypefun
-@deftypefun int mpfr_strtofr (mpfr_t @var{rop}, const char *@var{nptr}, char **@var{endptr}, unsigned int @var{base}, mp_rnd_t @var{rnd})
+@deftypefun int mpfr_strtofr (mpfr_t @var{rop}, const char *@var{nptr}, char **@var{endptr}, int @var{base}, mp_rnd_t @var{rnd})
- Read a floating point number from a string @var{nptr} in base @var{base}
- (from 2 to 62), rounded in direction @var{rnd}. If successful the
+ Read a floating point number from a string @var{nptr} in base @var{base},
+ rounded in the direction @var{rnd}. If successful, the
result is stored in @var{rop} and @code{*@var{endptr}} points to the
character just after those parsed. If @var{str} doesn't start with a
valid number then @var{rop} is set to zero and the value of @var{nptr}
@@ -765,18 +757,18 @@ using a third auxiliary variable.
Parsing follows the standard C @code{strtod} function. This means optional
leading whitespace, an optional @code{+} or @code{-}, mantissa digits, and an
- optional exponent consisting of an @code{e} or @code{E} (if
- @code{@var{base} <= 10}) or @code{@@}, an optional sign, and digits.
+ optional exponent consisting of an @code{e} or @code{E} (if
+ @math{@var{base} @le{} 10}) or @code{@@}, an optional sign, and digits.
A hex mantissa can be
- given with a leading @code{0x} or @code{0}', in which case @code{p} or
+ given with a leading @code{0x} or @code{0X}, in which case @code{p} or
@code{P} may introduce an optional binary exponent. A binary
mantissa can be given with a leading @code{0b} or @code{0B}, in which case
- @code{e}, @code{E}, @code{p}, @code{P} or @code{@@} may introduce the
+ @code{e}, @code{E}, @code{p}, @code{P} or @code{@@} may introduce the
binary exponent.
- In addition @code{infinity}, @code{inf} (if @code{@var{base} <= 10} )
+ In addition @code{infinity}, @code{inf} (if @math{@var{base} @le{} 10})
or @code{@@inf@@} with an optional sign, or @code{nan},
- @code{nan(n-char-sequence)} (if @code{@var{base} <= 10} ), @code{@@nan@@}
+ @code{nan(n-char-sequence)} (if @math{@var{base} @le{} 10}), @code{@@nan@@}
or @code{@@nan@@(n-char-sequence)} all non case significant, can be given.
A @code{n-char-sequence} is a string containing only digits (0, 1, 2, ..., 9)
and non-digits (_, a, b, ..., z, A, B, ..., Z).
@@ -785,7 +777,7 @@ using a third auxiliary variable.
be valid. If an exponent has no digits it's ignored and parsing
stops after the mantissa. If an @code{0x}, @code{0X}, @code{0b} or
@code{0B} is not followed by hexadecimal/binary digits, parsing stops
- after the first @code{0}:
+ after the first @code{0}:
the subject sequence is defined as the longest initial
subsequence of the input string, starting with the first
non-white-space character, that is of the expected form.
@@ -796,41 +788,57 @@ using a third auxiliary variable.
whereas @code{@@} represents a power of the base (i.e. 16).
If the argument @var{base} is different from 0, it must be in the range 2
- to 62. For bases up to 36,
- case is ignored; upper-case and lower-case letters have the same
- value; for bases 37 to 62, upper-case letter represent the usual
- 10..35, while lower-case letter represent 36..61.
-
- If @code{base} is 0, then it tries to indentify the used base: if the
- mantissa begins with the '0x' prefix, it assumes that @var{base} is 16.
- If it begins with '0b', it assumes that @var{base} is 2. Otherwise, it
+ to 36.
+@c For bases up to 36,
+ Case is ignored; upper-case and lower-case letters have the same
+ value
+@c ; for bases 37 to 62, upper-case letter represent the usual
+@c 10..35, while lower-case letter represent 36..61.
+
+ If @code{base} is 0, then it tries to identify the used base: if the
+ mantissa begins with the @code{0x} prefix, it assumes that @var{base} is 16.
+ If it begins with @code{0b}, it assumes that @var{base} is 2. Otherwise, it
assumes it is 10.
- It returns an usual ternary value.
- If @var{endptr} is not @code{NULL}, a pointer to the character after the last
- character used in the conversion is stored in the location
+ It returns a usual ternary value.
+ If @var{endptr} is not a null pointer, a pointer to the character after
+ the last character used in the conversion is stored in the location
referenced by @var{endptr}.
@end deftypefun
+@deftypefun void mpfr_set_inf (mpfr_t @var{x}, int @var{sign})
+@deftypefunx void mpfr_set_nan (mpfr_t @var{x})
+Set the variable @var{x} to infinity or NaN (Not-a-Number) respectively.
+In @code{mpfr_set_inf}, @var{x} is set to plus infinity iff @var{sign} is
+nonnegative.
+@end deftypefun
+
+@deftypefun void mpfr_swap (mpfr_t @var{x}, mpfr_t @var{y})
+Swap the values @var{x} and @var{y} efficiently. Warning: the
+precisions are exchanged too; in case the precisions are different,
+@code{mpfr_swap} is thus not equivalent to three @code{mpfr_set} calls
+using a third auxiliary variable.
+@end deftypefun
+
@node Combined Initialization and Assignment Functions, Conversion Functions, Assignment Functions, MPFR Interface
@comment node-name, next, previous, up
@cindex Combined initialization and assignment functions
@section Combined Initialization and Assignment Functions
-@deftypefun int mpfr_init_set (mpfr_t @var{rop}, mpfr_t @var{op}, mp_rnd_t @var{rnd})
-@deftypefunx int mpfr_init_set_ui (mpfr_t @var{rop}, unsigned long int @var{op}, mp_rnd_t @var{rnd})
-@deftypefunx int mpfr_init_set_si (mpfr_t @var{rop}, signed long int @var{op}, mp_rnd_t @var{rnd})
-@deftypefunx int mpfr_init_set_d (mpfr_t @var{rop}, double @var{op}, mp_rnd_t @var{rnd})
-@deftypefunx int mpfr_init_set_ld (mpfr_t @var{rop}, long double @var{op}, mp_rnd_t @var{rnd})
-@deftypefunx int mpfr_init_set_z (mpfr_t @var{rop}, mpz_t @var{op}, mp_rnd_t @var{rnd})
-@deftypefunx int mpfr_init_set_q (mpfr_t @var{rop}, mpq_t @var{op}, mp_rnd_t @var{rnd})
-@deftypefunx int mpfr_init_set_f (mpfr_t @var{rop}, mpf_t @var{op}, mp_rnd_t @var{rnd})
+@deftypefn Macro int mpfr_init_set (mpfr_t @var{rop}, mpfr_t @var{op}, mp_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_ui (mpfr_t @var{rop}, unsigned long int @var{op}, mp_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_si (mpfr_t @var{rop}, signed long int @var{op}, mp_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_d (mpfr_t @var{rop}, double @var{op}, mp_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_ld (mpfr_t @var{rop}, long double @var{op}, mp_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_z (mpfr_t @var{rop}, mpz_t @var{op}, mp_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_q (mpfr_t @var{rop}, mpq_t @var{op}, mp_rnd_t @var{rnd})
+@deftypefnx Macro int mpfr_init_set_f (mpfr_t @var{rop}, mpf_t @var{op}, mp_rnd_t @var{rnd})
Initialize @var{rop} and set its value from @var{op}, rounded in the direction
@var{rnd}.
The precision of @var{rop} will be taken from the active default precision,
as set by @code{mpfr_set_default_prec}.
-@end deftypefun
+@end deftypefn
@deftypefun int mpfr_init_set_str (mpfr_t @var{x}, const char *@var{s}, int @var{base}, mp_rnd_t @var{rnd})
Initialize @var{x} and set its value from
@@ -852,12 +860,6 @@ If the system doesn't support IEEE 754 standard, this function
might not preserve the signed zeros.
@end deftypefun
-@deftypefun double mpfr_get_d1 (mpfr_t @var{op})
-Convert @var{op} to a @code{double}, using the default MPFR rounding mode
-(see function @code{mpfr_set_default_rounding_mode}). This function is
-obsolete.
-@end deftypefun
-
@deftypefun double mpfr_get_d_2exp (long *@var{exp}, mpfr_t @var{op}, mp_rnd_t @var{rnd})
Return @var{d} and set @var{exp} such that @math{0.5@le{}@GMPabs{@var{d}}<1}
and @m{@var{d}\times 2^{exp}, @var{d} times 2 raised to @var{exp}} equals
@@ -868,7 +870,7 @@ and @m{@var{d}\times 2^{exp}, @var{d} times 2 raised to @var{exp}} equals
@deftypefunx {unsigned long} mpfr_get_ui (mpfr_t @var{op}, mp_rnd_t @var{rnd})
@deftypefunx intmax_t mpfr_get_sj (mpfr_t @var{op}, mp_rnd_t @var{rnd})
@deftypefunx uintmax_t mpfr_get_uj (mpfr_t @var{op}, mp_rnd_t @var{rnd})
-Convert @var{op} to a @code{long}, an @code{unsigned long},
+Convert @var{op} to a @code{long}, an @code{unsigned long},
an @code{intmax_t} or an @code{uintmax_t} (respectively) after rounding
it with respect to @var{rnd}.
If @var{op} is NaN, the result is undefined.
@@ -895,13 +897,13 @@ behavior is undefined.
@end deftypefun
@deftypefun void mpfr_get_z (mpz_t @var{rop}, mpfr_t @var{op}, mp_rnd_t @var{rnd})
-Convert @var{op} to a @code{mpz_t}, after rounding it with respect to
+Convert @var{op} to a @code{mpz_t}, after rounding it with respect to
@var{rnd}. If @var{op} is NaN or Inf, the result is undefined.
@end deftypefun
@deftypefun {char *} mpfr_get_str (char *@var{str}, mp_exp_t *@var{expptr}, int @var{base}, size_t @var{n}, mpfr_t @var{op}, mp_rnd_t @var{rnd})
Convert @var{op} to a string of digits in base @var{base}, with rounding in
-direction @var{rnd}. The base may vary from 2 to 36.
+the direction @var{rnd}. The base may vary from 2 to 36.
The generated string is a fraction, with an implicit radix point immediately
to the left of the first digit. For example, the number -3.1416 would be
@@ -921,7 +923,7 @@ the current allocation function, and a pointer to the string is returned.
To free the returned string, you must use @code{mpfr_free_str}.
If @var{str} is not a null pointer, it should point to a block of storage
-large enough for the mantissa, i.e., at least @code{max(@var{n} + 2, 7)}.
+large enough for the mantissa, i.e., at least @code{max(@var{n} + 2, 7)}.
The extra two bytes are for a possible minus sign, and for the terminating null
character.
@@ -939,7 +941,7 @@ case a null pointer is returned.
@deftypefun void mpfr_free_str (char *@var{str})
Free a string allocated by @code{mpfr_get_str} using the current unallocation
-function (preliminary interface).
+function (preliminary interface).
The block is assumed to be @code{strlen(@var{str})+1} bytes.
For more information about how it is done:
@pxref{Custom Allocation,,, gmp,GNU MP}.
@@ -1063,22 +1065,18 @@ Just changes the sign if @var{rop} and @var{op} are the same variable.
@deftypefun int mpfr_mul_2ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mp_rnd_t @var{rnd})
@deftypefunx int mpfr_mul_2si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mp_rnd_t @var{rnd})
-@deftypefunx int mpfr_mul_2exp (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mp_rnd_t @var{rnd})
Set @var{rop} to @m{@var{op1} \times 2^{op2}, @var{op1} times 2 raised
to @var{op2}}
rounded in the direction @var{rnd}. Just increases the exponent by @var{op2}
when @var{rop} and @var{op1} are identical.
-[@code{mpfr_mul_2exp} is kept for upward compatibility.]
@end deftypefun
@deftypefun int mpfr_div_2ui (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mp_rnd_t @var{rnd})
@deftypefunx int mpfr_div_2si (mpfr_t @var{rop}, mpfr_t @var{op1}, long int @var{op2}, mp_rnd_t @var{rnd})
-@deftypefunx int mpfr_div_2exp (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mp_rnd_t @var{rnd})
Set @var{rop} to @m{@var{op1}/2^{op2}, @var{op1} divided by 2 raised
to @var{op2}}
rounded in the direction @var{rnd}. Just decreases the exponent by @var{op2}
when @var{rop} and @var{op1} are identical.
-[@code{mpfr_div_2exp} is kept for upward compatibility.]
@end deftypefun
@node Comparison Functions, Special Functions, Basic Arithmetic Functions, MPFR Interface
@@ -1100,7 +1098,7 @@ Compare @var{op1} and @var{op2}. Return a positive value if @math{@var{op1} >
@math{@var{op1} < @var{op2}}.
Both @var{op1} and @var{op2} are considered to their full own precision,
which may differ.
-If one of the operands is NaN (Not-a-Number), it returns 0 and set
+If one of the operands is NaN (Not-a-Number), return zero and set
the erange flag.
@end deftypefun
@@ -1114,7 +1112,7 @@ the power @var{e}}. Similar as above.
Compare @math{|@var{op1}|} and @math{|@var{op2}|}. Return a positive value if
@math{|@var{op1}| > |@var{op2}|}, zero if @math{|@var{op1}| = |@var{op2}|}, and
a negative value if @math{|@var{op1}| < |@var{op2}|}.
-If one of the operands is NaN (Not-a-Number), it returns 0 and set
+If one of the operands is NaN (Not-a-Number), return zero and set
the erange flag.
@end deftypefun
@@ -1172,7 +1170,7 @@ compared), zero otherwise.
@cindex Special functions
All those functions, except explicitly stated, return zero for an
-exact return value, a positive value for a return value larger than the
+exact return value, a positive value for a return value larger than the
exact result, and a negative value otherwise.
@deftypefun int mpfr_log (mpfr_t @var{rop}, mpfr_t @var{op}, mp_rnd_t @var{rnd})
@@ -1280,22 +1278,24 @@ If any operand is negative, the return value is NaN.
Set @var{rop} to the logarithm of 2, the value of @m{\pi,Pi}, the value
of Euler's constant 0.577@dots{}, respectively, rounded in the direction
@var{rnd}. These functions cache the computed values to avoid other
-calculations if a lower or equal precision is requested. To free theses caches,
+calculations if a lower or equal precision is requested. To free these caches,
use @code{mpfr_free_cache}.
@end deftypefun
@deftypefun void mpfr_free_cache (void)
Free the cache used by the functions computing constants if needed
-(currently
+(currently
@code{mpfr_const_log2}, @code{mpfr_const_pi} and
@code{mpfr_const_euler}).
@end deftypefun
@deftypefun int mpfr_sum (mpfr_t @var{rop}, const mpfr_t* const @var{tab}[], unsigned long @var{n}, mp_rnd_t @var{rnd})
-Set @var{ret} to the sum of all elements of @var{tab} whose size is @var{n}, rounded in the direction @var{rnd}. Warning, @var{tab} is a table of pointer to mpfr_t, not a table of mpfr_t (priliminary interface).
+Set @var{ret} to the sum of all elements of @var{tab} whose size is @var{n},
+rounded in the direction @var{rnd}. Warning, @var{tab} is a table of pointers
+to mpfr_t, not a table of mpfr_t (preliminary interface).
@end deftypefun
-@node Input and Output Functions, Miscellaneous Functions, Special Functions, MPFR Interface
+@node Input and Output Functions, Integer Related Functions, Special Functions, MPFR Interface
@comment node-name, next, previous, up
@section Input and Output Functions
@cindex Float input and output functions
@@ -1315,7 +1315,7 @@ prototypes for these functions.
@deftypefun size_t mpfr_out_str (FILE *@var{stream}, int @var{base}, size_t @var{n}, mpfr_t @var{op}, mp_rnd_t @var{rnd})
Output @var{op} on stream @var{stream}, as a string of digits in
-base @var{base}, rounded in direction @var{rnd}.
+base @var{base}, rounded in the direction @var{rnd}.
The base may vary from 2 to 36. Print @var{n} significant digits exactly,
or if @var{n} is 0, the maximum number of digits accurately representable
by @var{op} (this feature may disappear).
@@ -1330,21 +1330,26 @@ Return the number of bytes written, or if an error occurred, return 0.
@deftypefun size_t mpfr_inp_str (mpfr_t @var{rop}, FILE *@var{stream}, int @var{base}, mp_rnd_t @var{rnd})
Input a string in base @var{base} from stream @var{stream},
-rounded in direction @var{rnd}, and put the
-read float in @var{rop}. The string is of the form @samp{M@@N} or, if the
-base is 10 or less, alternatively @samp{MeN} or @samp{MEN}, or, if the base
-is 16, alternatively @samp{MpB} or @samp{MPB}.
-@samp{M} is the mantissa in the specified base, @samp{N} is the exponent
-written in decimal for the specified base, and in base 16, @samp{B} is the
-binary exponent written in decimal (i.e.@: it indicates the power of 2 by
-which the mantissa is to be scaled).
-The argument @var{base} may be in the range 2 to 36.
-
-Special values can be read as follows (the case does not matter):
-@code{@@NaN@@}, @code{@@Inf@@}, @code{+@@Inf@@} and @code{-@@Inf@@},
-possibly followed by other characters; if the base is smaller or equal
-to 16, the following strings are accepted too: @code{NaN}, @code{Inf},
-@code{+Inf} and @code{-Inf}.
+rounded in the direction @var{rnd}, and put the
+read float in @var{rop}.
+@c The argument @var{base} must be in the range 2 to 36.
+
+@c The string is of the form @samp{M@@N} or, if the
+@c base is 10 or less, alternatively @samp{MeN} or @samp{MEN}, or, if the base
+@c is 16, alternatively @samp{MpB} or @samp{MPB}.
+@c @samp{M} is the mantissa in the specified base, @samp{N} is the exponent
+@c written in decimal for the specified base, and in base 16, @samp{B} is the
+@c binary exponent written in decimal (i.e.@: it indicates the power of 2 by
+@c which the mantissa is to be scaled).
+This function reads a word (defined as a sequence of characters between
+whitespace) and parses it using @code{mpfr_set_str} (it may change).
+See the documentation of @code{mpfr_strtofr} for a detailed description
+of the valid string formats.
+@c Special values can be read as follows (the case does not matter):
+@c @code{@@NaN@@}, @code{@@Inf@@}, @code{+@@Inf@@} and @code{-@@Inf@@},
+@c possibly followed by other characters; if the base is smaller or equal
+@c to 16, the following strings are accepted too: @code{NaN}, @code{Inf},
+@c @code{+Inf} and @code{-Inf}.
Return the number of bytes read, or if an error occurred, return 0.
@end deftypefun
@@ -1354,10 +1359,10 @@ Return the number of bytes read, or if an error occurred, return 0.
@c @code{mpfr_out_raw}, and put the result in @var{float}.
@c @end deftypefun
-@node Miscellaneous Functions, Rounding Modes, Input and Output Functions, MPFR Interface
+@node Integer Related Functions, Miscellaneous Functions, Input and Output Functions, MPFR Interface
@comment node-name, next, previous, up
-@section Miscellaneous Functions
-@cindex Miscellaneous float functions
+@section Integer Related Functions
+@cindex Integer Related Functions
@deftypefun int mpfr_rint (mpfr_t @var{rop}, mpfr_t @var{op}, mp_rnd_t @var{rnd})
@deftypefunx int mpfr_ceil (mpfr_t @var{rop}, mpfr_t @var{op})
@@ -1413,6 +1418,11 @@ the fractional part is generated).
Return non-zero iff @var{op} is an integer.
@end deftypefun
+@node Miscellaneous Functions, Rounding Modes, Integer Related Functions, MPFR Interface
+@comment node-name, next, previous, up
+@section Miscellaneous Functions
+@cindex Miscellaneous float functions
+
@deftypefun void mpfr_nexttoward (mpfr_t @var{x}, mpfr_t @var{y})
If @var{x} or @var{y} is NaN, set @var{x} to NaN. Otherwise, if @var{x}
is different from @var{y}, replace @var{x} by the next floating-point
@@ -1492,7 +1502,7 @@ Return the MPFR version, as a null-terminated string.
@defmacx MPFR_VERSION_MINOR
@defmacx MPFR_VERSION_PATCHLEVEL
@code{MPFR_VERSION} is the version of MPFR as a preprocessing constant.
-@code{MPFR_VERSION_MAJOR}, @code{MPFR_VERSION_MINOR} and
+@code{MPFR_VERSION_MAJOR}, @code{MPFR_VERSION_MINOR} and
@code{MPFR_VERSION_PATCHLEVEL} are respectively the major, minor and patch
level of MPFR version, as preprocessing constants.
@end defmac
@@ -1500,7 +1510,7 @@ level of MPFR version, as preprocessing constants.
@deftypefn Macro long MPFR_VERSION_NUM (@var{major}, @var{minor}, @var{patchlevel})
Create an integer in the same format as used by @code{MPFR_VERSION} from the
given @var{major}, @var{minor} and @var{patchlevel}.
-Here is an example of how to check the MPFR version at compiled time:
+Here is an example of how to check the MPFR version at compile time:
@example
#if (!defined(MPFR_VERSION) || (MPFR_VERSION<MPFR_VERSION_NUM(2,1,0)))
# error "Wrong MPFR version."
@@ -1513,16 +1523,16 @@ Here is an example of how to check the MPFR version at compiled time:
@cindex Rounding Modes
@deftypefun void mpfr_set_default_rounding_mode (mp_rnd_t @var{rnd})
-Sets the default rounding mode to @var{rnd}.
+Set the default rounding mode to @var{rnd}.
The default rounding mode is to nearest initially.
@end deftypefun
@deftypefun mp_rnd_t mpfr_get_default_rounding_mode (void)
-Gets the default rounding mode.
+Get the default rounding mode.
@end deftypefun
@deftypefun int mpfr_prec_round (mpfr_t @var{x}, mp_prec_t @var{prec}, mp_rnd_t @var{rnd})
-Rounds @var{x} according to @var{rnd} with precision @var{prec}, which
+Round @var{x} according to @var{rnd} with precision @var{prec}, which
must be an integer between @code{MPFR_PREC_MIN} and @code{MPFR_PREC_MAX}
(otherwise the behavior is undefined).
If @var{prec} is greater or equal to the precision of @var{x}, then new
@@ -1536,7 +1546,7 @@ direction. In both cases, the precision of @var{x} is changed to @var{prec}.
@end deftypefun
@deftypefun {const char *} mpfr_print_rnd_mode (mp_rnd_t @var{rnd})
-Returns the input string (GMP_RNDD, GMP_RNDU, GMP_RNDN, GMP_RNDZ)
+Return the input string (GMP_RNDD, GMP_RNDU, GMP_RNDN, GMP_RNDZ)
corresponding to the rounding mode @var{rnd} or a null pointer if
@var{rnd} is an invalid rounding mode.
@end deftypefun
@@ -1548,7 +1558,7 @@ corresponding to the rounding mode @var{rnd} or a null pointer if
@cindex Exceptions
Note: Overflow handling is still experimental and currently implemented
-very partially. If an overflow occurs internally at the wrong place,
+partially. If an overflow occurs internally at the wrong place,
anything can happen (crash, wrong results, etc).
@deftypefun mp_exp_t mpfr_get_emin (void)
@@ -1578,9 +1588,9 @@ behavior will be undefined, in the sense of the ISO C standard.
@deftypefunx mp_exp_t mpfr_get_emax_min (void)
@deftypefunx mp_exp_t mpfr_get_emax_max (void)
Return the minimum and maximum of the smallest and largest exponents
-allowed for @code{mpfr_set_emin} and @code{mpfr_set_emax}. Theses values
+allowed for @code{mpfr_set_emin} and @code{mpfr_set_emax}. These values
are implementation dependent; it is possible to create a non
-portable program by writting @code{mpfr_set_emax(mpfr_get_emax_max())}
+portable program by writing @code{mpfr_set_emax(mpfr_get_emax_max())}
and @code{mpfr_set_emin(mpfr_get_emin_min())} since the values
of the smallest and largest exponents become implementation dependent.
@end deftypefun
@@ -1617,7 +1627,7 @@ Clear all global flags (underflow, overflow, inexact, invalid, erange).
@deftypefunx int mpfr_nanflag_p (void)
@deftypefunx int mpfr_inexflag_p (void)
@deftypefunx int mpfr_erangeflag_p (void)
-Return the corresponding (underflow, overflow, invalid, inexact, erange)
+Return the corresponding (underflow, overflow, invalid, inexact, erange)
flag, which is non-zero iff the flag is set.
@end deftypefun
@@ -1635,7 +1645,8 @@ flag, which is non-zero iff the flag is set.
@section Advanced Functions
@cindex Advanced Functions
-All the given interface are preliminary. It might change incompatibly in future revisions.
+All the given interfaces are preliminary. They might change incompatibly in
+future revisions.
@defmac MPFR_DECL_INIT (@var{name}, @var{prec})
This macro declares @var{name} as an automatic variable of type @code{mpfr_t},
@@ -1645,42 +1656,42 @@ You must use this macro in the declaration section. This macro is much faster th
drawbacks:
@itemize @bullet
-@item You @strong{must not} call @code{mpfr_clear} with variables
+@item You @strong{must not} call @code{mpfr_clear} with variables
created with this macro (The storage is allocated at the point of declaration
and deallocated when the brace-level is exited.).
@item You @strong{can not} change their precision.
@item You @strong{should not} create variables with huge precision with this macro.
@item Your compiler must support @samp{Non-Constant Initializers} (standard
-in C++ and ISO C99) and @samp{Tokken Pasting}
+in C++ and ISO C99) and @samp{Token Pasting}
(standard in ISO C89). If @var{prec} is not a compiler constant, your compiler
must support @samp{Variable-length automatic arrays} (standard in ISO C99).
-@samp{GCC 2.95.3} supports all theses features.
+@samp{GCC 2.95.3} supports all these features.
@end itemize
@end defmac
@deftypefun void mpfr_inits (mpfr_t @var{x}, ...)
Initialize all the @code{mpfr_t} variables of the given @code{va_list},
-set their precision to be the default precision and their value to NaN.
+set their precision to be the default precision and their value to NaN.
See @code{mpfr_init} for more details.
The @code{va_list} is assumed to be composed only of type @code{mpfr_t}.
-It begins from @var{x}. It ends when it encounters a @code{NULL} pointer.
+It begins from @var{x}. It ends when it encounters a null pointer.
@end deftypefun
@deftypefun void mpfr_inits2 (mp_prec_t @var{prec}, mpfr_t @var{x}, ...)
Initialize all the @code{mpfr_t} variables of the given @code{va_list},
set their precision to be @strong{exactly}
-@var{prec} bits and their value to NaN.
+@var{prec} bits and their value to NaN.
See @code{mpfr_init2} for more details.
The @code{va_list} is assumed to be composed only of type @code{mpfr_t}.
-It begins from @var{x}. It ends when it encounters a @code{NULL} pointer.
+It begins from @var{x}. It ends when it encounters a null pointer.
@end deftypefun
@deftypefun void mpfr_clears (mpfr_t @var{x}, ...)
Free the space occupied by all the @code{mpfr_t} variables of the given
@code{va_list}. See @code{mpfr_clear} for more details.
The @code{va_list} is assumed to be composed only of type @code{mpfr_t}.
-It begins from @var{x}. It ends when it encounters a @code{NULL} pointer.
+It begins from @var{x}. It ends when it encounters a null pointer.
@end deftypefun
Here is an example of how to use multiple initialization functions:
@@ -1688,9 +1699,9 @@ Here is an example of how to use multiple initialization functions:
@example
@{
mpfr_t x, y, z, t;
- mpfr_inits2 (256, x, y, z, t, NULL);
+ mpfr_inits2 (256, x, y, z, t, (void *) 0);
@dots{}
- mpfr_clears (x, y, z, t, NULL);
+ mpfr_clears (x, y, z, t, (void *) 0);
@}
@end example
@@ -1741,6 +1752,13 @@ it just computes @math{|@var{op1}-@var{op2}|/@var{op1}}, using the
rounding mode @var{rnd} for all operations and the precision of @var{rop}.
@end deftypefun
+@deftypefun int mpfr_mul_2exp (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mp_rnd_t @var{rnd})
+@deftypefunx int mpfr_div_2exp (mpfr_t @var{rop}, mpfr_t @var{op1}, unsigned long int @var{op2}, mp_rnd_t @var{rnd})
+See @code{mpfr_mul_2ui} and @code{mpfr_div_2ui}. These functions are only kept
+for compatibility with MPF.
+@end deftypefun
+
+
@node Internals, , Compatibility with MPF, MPFR Interface
@section Internals
@cindex Internals
@@ -1758,7 +1776,7 @@ The @code{mpfr_t} type consists of four fields.
@item The @code{_mpfr_prec} field is used to store the precision of
the variable (in bits); this is not less than @code{MPFR_PREC_MIN}.
-@item The @code{_mpfr_sign} field is used to store the sign of the variable.
+@item The @code{_mpfr_sign} field is used to store the sign of the variable.
@item The @code{_mpfr_exp} field stores the exponent.
An exponent of 0 means a radix point just above the most significant
@@ -1769,7 +1787,7 @@ A NaN, an Infinity and a Zero are indicated by a special value of the exponent.
@item Finally, the @code{_mpfr_d} is a pointer to the limbs, least
significant limbs stored first.
The number of limbs in use is controlled by @code{_mpfr_prec}, namely
-ceil(@code{_mpfr_prec}/@code{BITS_PER_MP_LIMB}).
+ceil(@code{_mpfr_prec}/@code{mp_bits_per_limb}).
Non-singular values always have the most significant bit of the most
significant limb set to 1. When the precision does not correspond to a
whole number of limbs, the excess bits at the low end of the data are zero.
@@ -1793,14 +1811,21 @@ whole number of limbs, the excess bits at the low end of the data are zero.
@deftypefun int mpfr_can_round (mpfr_t @var{b}, mp_exp_t @var{err}, mp_rnd_t @var{rnd1}, mp_rnd_t @var{rnd2}, mp_prec_t @var{prec})
Assuming @var{b} is an approximation of an unknown number
-@var{x} in direction @var{rnd1} with error at most two to the power
-E(b)-@var{err} where E(b) is the exponent of @var{b}, returns a non-zero
+@var{x} in the direction @var{rnd1} with error at most two to the power
+E(b)-@var{err} where E(b) is the exponent of @var{b}, return a non-zero
value if one is able to round exactly @var{x} to precision
-@var{prec} with direction @var{rnd2},
+@var{prec} with the direction @var{rnd2},
and 0 otherwise (including for NaN and Inf).
This function @strong{does not modify} its arguments.
@end deftypefun
+@deftypefun double mpfr_get_d1 (mpfr_t @var{op})
+Convert @var{op} to a @code{double}, using the default MPFR rounding mode
+(see function @code{mpfr_set_default_rounding_mode}). This function is
+obsolete.
+@end deftypefun
+
+
@c @deftypefun void mpfr_set_str_binary (mpfr_t @var{x}, const char *@var{s})
@c Set @var{x} to the value of the binary number in string @var{s}, which has to
@c be of the
@@ -1823,15 +1848,16 @@ This function @strong{does not modify} its arguments.
@unnumbered Contributors
The main developers consist of Guillaume Hanrot, Vincent Lef@`evre,
-Kevin Ryde and Paul Zimmermann.
+Patrick P@'elissier and Paul Zimmermann.
We would like to thank Jean-Michel Muller and Joris van der Hoeven for very
fruitful discussions at the beginning of that project, Torbj@"orn Granlund
-and Kevin Ryde
-for their help about design issues
-and their suggestions for an easy integration into GNU MP,
+and Kevin Ryde for their help about design issues,
and Nathalie Revol for her careful reading of a previous version of
this documentation.
+Kevin Ryde did a tremendous job for the portability of MPFR,
+and integrating it into GMP 4.x;
+alas the GMP developers decided in January 2004 not to include MPFR any more.
Sylvie Boldo from ENS-Lyon, France,
contributed the functions @code{mpfr_agm} and @code{mpfr_log}.
@@ -1848,13 +1874,10 @@ contributed the original version of @file{mul_ui.c}, the @file{gmp_op.c}
file, and helped to the Windows porting.
Jean-Luc R@'emy contributed the @code{mpfr_zeta} code.
Ludovic Meunier helped in the design of the @code{mpfr_erf} code.
-Patrick P@'elissier has worked on low-precision optimizations
-(new internal format), on debugging (specially the file @file{gmp_op.c})
-and on some other functions (@code{MPFR_DECL_INIT}, @code{mpfr_set_sj}, etc.).
The development of the MPFR library would not have been possible without the
continuous support of LORIA, INRIA and INRIA Lorraine.
-The development of MPFR was also supported by a grant
+The development of MPFR was also supported by a grant
(202F0659 00 MPN 121) from the Conseil R@'egional de Lorraine in 2002.
@node References, GNU Free Documentation License, Contributors, Top
diff --git a/mul.c b/mul.c
index 8c65d8655..a52493e26 100644
--- a/mul.c
+++ b/mul.c
@@ -22,7 +22,7 @@ MA 02111-1307, USA. */
#include "mpfr-impl.h"
int
-mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
+mpfr_mul (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
{
int sign_product, cc, inexact;
mp_exp_t ax;
diff --git a/set_d.c b/set_d.c
index b9c3cba0d..012d09543 100644
--- a/set_d.c
+++ b/set_d.c
@@ -21,6 +21,7 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, 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
#include "mpfr-impl.h"
diff --git a/set_str.c b/set_str.c
index 302fa6fb5..60e073124 100644
--- a/set_str.c
+++ b/set_str.c
@@ -25,6 +25,10 @@ MA 02111-1307, USA. */
#define MPFR_NEED_LONGLONG_H
#include "mpfr-impl.h"
+
+/* Old code */
+#if 0
+
#include "log_b2.h"
static double __gmpfr_ceil _MPFR_PROTO((double));
@@ -384,6 +388,19 @@ mpfr_set_str (mpfr_t x, const char *str, int base, mp_rnd_t rnd)
return res;
}
+#endif
+
+int
+mpfr_set_str (mpfr_t x, const char *str, int base, mp_rnd_t rnd)
+{
+ char *p;
+
+ if (MPFR_UNLIKELY (*str == 0))
+ return -1;
+ mpfr_strtofr (x, str, &p, base, rnd);
+ return (*p == 0) ? 0 : -1;
+}
+
int
mpfr_init_set_str (mpfr_ptr x, const char *str, int base, mp_rnd_t rnd)
diff --git a/strtofr.c b/strtofr.c
index 01d77ec63..471a47725 100644
--- a/strtofr.c
+++ b/strtofr.c
@@ -125,22 +125,22 @@ int main ()
mpfr_ui_div (x, 1, x, GMP_RNDN);
printf ("Base: %d x=%e ", base, mpfr_get_d1 (x));
for (i = 0 ; i < N ; i++)
- {
- mpfr_floor (y, x);
- tab[i] = mpfr_get_ui (y, GMP_RNDN);
- mpfr_sub (x, x, y, GMP_RNDN);
- mpfr_ui_div (x, 1, x, GMP_RNDN);
- }
+ {
+ mpfr_floor (y, x);
+ tab[i] = mpfr_get_ui (y, GMP_RNDN);
+ mpfr_sub (x, x, y, GMP_RNDN);
+ mpfr_ui_div (x, 1, x, GMP_RNDN);
+ }
for (i = N-1 ; i >= 0 ; i--)
- if (tab[i] != 0)
- break;
+ if (tab[i] != 0)
+ break;
mpq_set_ui (q1, tab[i], 1);
for (i = i-1 ; i >= 0 ; i--)
- {
- mpq_inv (q1, q1);
- mpq_set_ui (q2, tab[i], 1);
- mpq_add (q1, q1, q2);
- }
+ {
+ mpq_inv (q1, q1);
+ mpq_set_ui (q2, tab[i], 1);
+ mpq_add (q1, q1, q2);
+ }
printf("Approx: ", base);
mpq_out_str (stdout, 10, q1);
printf (" = %e\n", mpq_get_d (q1) );
@@ -150,10 +150,10 @@ int main ()
mpz_out_str (stderr, 10, mpq_denref (q1));
fprintf (stderr, "UL},\n");
if (mpz_cmp_ui (mpq_numref (q1), 1<<16-1) >= 0
- || mpz_cmp_ui (mpq_denref (q1), 1<<16-1) >= 0)
- overflow = 1, base_overflow = base;
+ || mpz_cmp_ui (mpq_denref (q1), 1<<16-1) >= 0)
+ overflow = 1, base_overflow = base;
}
-
+
mpq_clear (q2);
mpq_clear (q1);
mpfr_clear (y);
@@ -182,7 +182,7 @@ digit_value_in_base (int c, int base)
digit = c - 'A' + 10;
else
return -1;
-
+
return MPFR_LIKELY (digit < base) ? digit : -1;
}
@@ -191,27 +191,27 @@ digit_value_in_base (int c, int base)
It returns:
-1 if invalid string,
0 if special string (like nan),
- 1 if the string is ok.
+ 1 if the string is ok.
2 if overflows
3 if underflows
So it doesn't return the ternary value
BUT if it returns 0 (NAN or INF), the ternary value is also '0'
(ie NAN and INF are exact) */
static int
-parse_string (mpfr_t x, struct parsed_string *pstr,
- const char **string, int base)
+parse_string (mpfr_t x, struct parsed_string *pstr,
+ const char **string, int base)
{
const char *str = *string;
unsigned char *mant;
int point;
int res = -1; /* Invalid input return value */
const char *prefix_str;
-
+
/* Init variable */
pstr->mantissa = NULL;
/* Optional leading whitespace */
- while (isspace(*str)) str++;
+ while (isspace((unsigned char) *str)) str++;
/* Can be case-insensitive NAN */
if (strncasecmp (str, "@nan@", 5) == 0)
@@ -225,17 +225,17 @@ parse_string (mpfr_t x, struct parsed_string *pstr,
set_nan:
/* Check for "(dummychars)" */
if (*str == '(')
- {
- const char *s;
- for (s = str+1 ; *s != ')' ; s++)
- if (!(*s >= 'A' && *s <= 'Z')
- && !(*s >= 'a' && *s <= 'z')
- && !(*s >= '0' && *s <= '9')
- && *s != '_')
- break;
- if (*s == ')')
- str = s+1;
- }
+ {
+ const char *s;
+ for (s = str+1 ; *s != ')' ; s++)
+ if (!(*s >= 'A' && *s <= 'Z')
+ && !(*s >= 'a' && *s <= 'z')
+ && !(*s >= '0' && *s <= '9')
+ && *s != '_')
+ break;
+ if (*s == ')')
+ str = s+1;
+ }
*string = str;
MPFR_SET_NAN(x);
/* MPFR_RET_NAN not used as the return value isn't a ternary value */
@@ -267,18 +267,20 @@ parse_string (mpfr_t x, struct parsed_string *pstr,
MPFR_SET_INF (x);
(pstr->negative) ? MPFR_SET_NEG (x) : MPFR_SET_POS (x);
return 0;
- }
+ }
/* If base=0 or 16, it may include '0x' prefix */
prefix_str = NULL;
- if ((base == 0 || base == 16) && str[0]=='0' && str[1]=='x')
+ if ((base == 0 || base == 16) && str[0]=='0'
+ && (str[1]=='x' || str[1] == 'X'))
{
prefix_str = str;
base = 16;
str += 2;
}
/* If base=0 or 2, it may include '0b' prefix */
- if ((base == 0 || base == 2) && str[0]=='0' && str[1]=='b')
+ if ((base == 0 || base == 2) && str[0]=='0'
+ && (str[1]=='b' || str[1] == 'B'))
{
prefix_str = str;
base = 2;
@@ -305,15 +307,15 @@ parse_string (mpfr_t x, struct parsed_string *pstr,
int c = *str++;
if (c == '.')
{
- if (MPFR_UNLIKELY(point)) /* Second '.': stop parsing */
- break;
+ if (MPFR_UNLIKELY(point)) /* Second '.': stop parsing */
+ break;
point = 1;
continue;
}
c = digit_value_in_base (c, base);
if (c == -1)
- break;
- *mant++ = (char) c;
+ break;
+ *mant++ = (char) c;
if (!point)
pstr->exp_base ++;
}
@@ -325,46 +327,47 @@ parse_string (mpfr_t x, struct parsed_string *pstr,
if (pstr->prec == 0)
{
/* Check if there was a prefix (in such a case, we have to read
- again the mantissa without skipping the prefix)
- The allocated mantissa is still enought big since we will
- read only 0, and we alloc one more char than needed.
- FIXME: Not really friendly. Maybe cleaner code? */
+ again the mantissa without skipping the prefix)
+ The allocated mantissa is still enought big since we will
+ read only 0, and we alloc one more char than needed.
+ FIXME: Not really friendly. Maybe cleaner code? */
if (prefix_str != NULL)
- {
- str = prefix_str;
- prefix_str = NULL;
- goto parse_begin;
- }
+ {
+ str = prefix_str;
+ prefix_str = NULL;
+ goto parse_begin;
+ }
goto end;
}
/* Valid entry */
- res = 1;
+ res = 1;
/* an optional exponent (e or E, p or P, @) */
- if ( (*str == '@' || (base <= 10 && (*str == 'e' || *str == 'E')))
- && (!isspace(str[1])) )
+ if ( (*str == '@' || (base <= 10 && (*str == 'e' || *str == 'E')))
+ && (!isspace((unsigned char) str[1])) )
{
char *endptr[1];
/* the exponent digits are kept in ASCII */
mp_exp_t read_exp = strtol (str + 1, endptr, 10);
mp_exp_t sum = 0;
if (endptr[0] != str+1)
- str = endptr[0];
+ str = endptr[0];
MPFR_ASSERTN (read_exp == (long) read_exp);
MPFR_SADD_OVERFLOW (sum, read_exp, pstr->exp_base,
- mp_exp_t, mp_exp_unsigned_t,
- MPFR_EXP_MIN, MPFR_EXP_MAX,
- res = 2, res = 3);
+ mp_exp_t, mp_exp_unsigned_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ res = 2, res = 3);
pstr->exp_base = sum;
}
else if ((base == 2 || base == 16)
- && (*str == 'p' || *str == 'P') && (!isspace(str[1])))
+ && (*str == 'p' || *str == 'P')
+ && (!isspace((unsigned char) str[1])))
{
char *endptr[1];
pstr->exp_bin = (mp_exp_t) strtol (str + 1, endptr, 10);
if (endptr[0] != str+1)
- str = endptr[0];
+ str = endptr[0];
}
/* Remove 0's at the beginning and end of mant_s[0..prec_s-1] */
@@ -390,7 +393,7 @@ parse_string (mpfr_t x, struct parsed_string *pstr,
if (pstr->mantissa != NULL && res != 1)
(*__gmp_free_func) (pstr->mantissa, pstr->alloc);
return res;
-}
+}
/* Transform a parsed string to a mpfr_t according to the rounding mode
and the precision of x.
@@ -420,27 +423,27 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd)
ysize_bits = ysize * BITS_PER_MP_LIMB;
y = (mp_limb_t*) TMP_ALLOC ((2 * ysize + 1) * sizeof (mp_limb_t));
y += ysize;
-
- /* required precision for str to have ~ysize limbs
- We must have (2^(BITS_PER_MP_LIMB))^ysize ~= base^pstr_size
- aka pstr_size = ceil (ysize*BITS_PER_MP_LIMB/log2(base))
- ysize ~ prec/BITS_PER_MP_LIMB and prec < Umax/2 =>
- ysize*BITS_PER_MP_LIMB can not overflow.
- Compute pstr_size = ysize_bits * Num / Den
- Where Num/Den ~ 1/log2(base)
- It is not exactly ceil(1/log2(base)) but could be one more (base 2)
- Quite ugly since it tries to avoid overflow */
+
+ /* required precision for str to have ~ysize limbs
+ We must have (2^(BITS_PER_MP_LIMB))^ysize ~= base^pstr_size
+ aka pstr_size = ceil (ysize*BITS_PER_MP_LIMB/log2(base))
+ ysize ~ prec/BITS_PER_MP_LIMB and prec < Umax/2 =>
+ ysize*BITS_PER_MP_LIMB can not overflow.
+ Compute pstr_size = ysize_bits * Num / Den
+ Where Num/Den ~ 1/log2(base)
+ It is not exactly ceil(1/log2(base)) but could be one more (base 2)
+ Quite ugly since it tries to avoid overflow */
pstr_size = ( ysize_bits / RedInvLog2Table[pstr->base-2][1]
- * RedInvLog2Table[pstr->base-2][0] )
- + (( ysize_bits % RedInvLog2Table[pstr->base-2][1])
- * RedInvLog2Table[pstr->base-2][0]
- / RedInvLog2Table[pstr->base-2][1] )
- + 1;
+ * RedInvLog2Table[pstr->base-2][0] )
+ + (( ysize_bits % RedInvLog2Table[pstr->base-2][1])
+ * RedInvLog2Table[pstr->base-2][0]
+ / RedInvLog2Table[pstr->base-2][1] )
+ + 1;
if (pstr_size >= pstr->prec)
pstr_size = pstr->prec;
MPFR_ASSERTD ((mp_exp_t) pstr_size == (mp_exp_t) pstr_size);
-
+
/* convert str into binary */
real_ysize = mpn_set_str (y, pstr->mant, pstr_size, pstr->base);
MPFR_ASSERTD ( real_ysize <= ysize+1);
@@ -461,13 +464,13 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd)
MPN_ZERO (y, ysize - real_ysize);
}
/* for each bit shift decrease exponent of y */
- /* (This should not overflow) */
+ /* (This should not overflow) */
exp = - ((ysize - real_ysize) * BITS_PER_MP_LIMB + count);
}
else /* shift y for the right */
{
/* shift {y, num_limb} for (BITS_PER_MP_LIMB - count) bits
- to the right */
+ to the right */
mpn_rshift (y, y, real_ysize, BITS_PER_MP_LIMB - count);
/* for each bit shift increase exponent of y */
exp = BITS_PER_MP_LIMB - count;
@@ -476,53 +479,53 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd)
/* compute base^(exp_s-pr) on n limbs */
if (IS_POW2 (pstr->base))
{
- /* Base: 2, 4, 8, 16, 32 */
+ /* Base: 2, 4, 8, 16, 32 */
int pow2;
- mp_exp_t tmp;
+ mp_exp_t tmp;
count_leading_zeros (pow2, (mp_limb_t) pstr->base);
pow2 = BITS_PER_MP_LIMB - pow2 - 1; /* base = 2^pow2 */
- MPFR_ASSERTD (0 < pow2 && pow2 <= 5);
- /* exp += pow2 * (pstr->exp_base - pstr_size) + pstr->exp_bin
- with overflow checking
- and check that we can add/substract 2 to exp without overflow */
- MPFR_SADD_OVERFLOW (tmp, pstr->exp_base, -(mp_exp_t) pstr_size,
- mp_exp_t, mp_exp_unsigned_t,
- MPFR_EXP_MIN, MPFR_EXP_MAX,
- goto overflow, goto underflow);
- /* On some FreeBsd/Alpha, LONG_MIN/1 produces an exception
- so we check for this before doing the division */
- if (tmp > 0 && pow2 != 1 && MPFR_EXP_MAX/pow2 <= tmp)
- goto overflow;
- else if (tmp < 0 && pow2 != 1 && MPFR_EXP_MIN/pow2 >= tmp)
- goto underflow;
- tmp *= pow2;
- MPFR_SADD_OVERFLOW (tmp, tmp, pstr->exp_bin,
- mp_exp_t, mp_exp_unsigned_t,
- MPFR_EXP_MIN, MPFR_EXP_MAX,
- goto overflow, goto underflow);
- MPFR_SADD_OVERFLOW (exp, exp, tmp,
- mp_exp_t, mp_exp_unsigned_t,
- MPFR_EXP_MIN+2, MPFR_EXP_MAX-2,
- goto overflow, goto underflow);
- result = y;
- err = 0;
+ MPFR_ASSERTD (0 < pow2 && pow2 <= 5);
+ /* exp += pow2 * (pstr->exp_base - pstr_size) + pstr->exp_bin
+ with overflow checking
+ and check that we can add/substract 2 to exp without overflow */
+ MPFR_SADD_OVERFLOW (tmp, pstr->exp_base, -(mp_exp_t) pstr_size,
+ mp_exp_t, mp_exp_unsigned_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto overflow, goto underflow);
+ /* On some FreeBsd/Alpha, LONG_MIN/1 produces an exception
+ so we check for this before doing the division */
+ if (tmp > 0 && pow2 != 1 && MPFR_EXP_MAX/pow2 <= tmp)
+ goto overflow;
+ else if (tmp < 0 && pow2 != 1 && MPFR_EXP_MIN/pow2 >= tmp)
+ goto underflow;
+ tmp *= pow2;
+ MPFR_SADD_OVERFLOW (tmp, tmp, pstr->exp_bin,
+ mp_exp_t, mp_exp_unsigned_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto overflow, goto underflow);
+ MPFR_SADD_OVERFLOW (exp, exp, tmp,
+ mp_exp_t, mp_exp_unsigned_t,
+ MPFR_EXP_MIN+2, MPFR_EXP_MAX-2,
+ goto overflow, goto underflow);
+ result = y;
+ err = 0;
}
/* case pstr->exp_base > pstr_size */
else if (pstr->exp_base > (mp_exp_t) pstr_size)
{
- mp_limb_t *z;
- mp_exp_t exp_z;
-
+ mp_limb_t *z;
+ mp_exp_t exp_z;
+
result = (mp_limb_t*) TMP_ALLOC ((2*ysize+1)*BYTES_PER_MP_LIMB);
/* z = base^(exp_base-sptr_size) using space allocated at y-ysize */
z = y - ysize;
- /* NOTE: exp_base-pstr_size can't overflow since pstr_size > 0 */
- err = mpfr_mpn_exp (z, &exp_z, pstr->base,
- pstr->exp_base - pstr_size, ysize);
+ /* NOTE: exp_base-pstr_size can't overflow since pstr_size > 0 */
+ err = mpfr_mpn_exp (z, &exp_z, pstr->base,
+ pstr->exp_base - pstr_size, ysize);
if (err == -2)
- goto overflow;
+ goto overflow;
exact = exact && (err == -1);
/* multiply(y = 0.mant_s[0]...mant_s[pr-1])_base by base^(exp_s-g) */
@@ -534,35 +537,35 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd)
err ++;
/* compute the exponent of y */
- /* exp += exp_z + ysize_bits with overflow checking
- and check that we can add/substract 2 to exp without overflow */
- MPFR_SADD_OVERFLOW (exp_z, exp_z, ysize_bits,
- mp_exp_t, mp_exp_unsigned_t,
- MPFR_EXP_MIN, MPFR_EXP_MAX,
- goto overflow, goto underflow);
- MPFR_SADD_OVERFLOW (exp, exp, exp_z,
- mp_exp_t, mp_exp_unsigned_t,
- MPFR_EXP_MIN+2, MPFR_EXP_MAX-2,
- goto overflow, goto underflow);
+ /* exp += exp_z + ysize_bits with overflow checking
+ and check that we can add/substract 2 to exp without overflow */
+ MPFR_SADD_OVERFLOW (exp_z, exp_z, ysize_bits,
+ mp_exp_t, mp_exp_unsigned_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto overflow, goto underflow);
+ MPFR_SADD_OVERFLOW (exp, exp, exp_z,
+ mp_exp_t, mp_exp_unsigned_t,
+ MPFR_EXP_MIN+2, MPFR_EXP_MAX-2,
+ goto overflow, goto underflow);
/* normalize result */
if (MPFR_LIMB_MSB (result[2 * ysize - 1]) == 0)
{
- mp_limb_t *r = result + ysize - 1;
+ mp_limb_t *r = result + ysize - 1;
mpn_lshift (r, r, ysize + 1, 1);
- /* Overflow checking not needed */
+ /* Overflow checking not needed */
exp --;
}
- exact = exact && (mpn_scan1 (result, 0)
- >= (unsigned long) ysize_bits);
- result += ysize;
+ exact = exact && (mpn_scan1 (result, 0)
+ >= (unsigned long) ysize_bits);
+ result += ysize;
}
/* case exp_base < pstr_size */
else if (pstr->exp_base < (mp_exp_t) pstr_size)
{
- mp_limb_t *z;
- mp_exp_t exp_z;
+ mp_limb_t *z;
+ mp_exp_t exp_z;
result = (mp_limb_t*) TMP_ALLOC ( (3*ysize+1) * BYTES_PER_MP_LIMB);
@@ -570,63 +573,63 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd)
y = y - ysize; /* we have allocated ysize limbs at y - ysize */
MPN_ZERO (y, ysize);
- /* pstr_size - pstr->exp_base can overflow */
- MPFR_SADD_OVERFLOW (exp_z, (mp_exp_t) pstr_size, -pstr->exp_base,
- mp_exp_t, mp_exp_unsigned_t,
- MPFR_EXP_MIN, MPFR_EXP_MAX,
- goto underflow, goto overflow);
+ /* pstr_size - pstr->exp_base can overflow */
+ MPFR_SADD_OVERFLOW (exp_z, (mp_exp_t) pstr_size, -pstr->exp_base,
+ mp_exp_t, mp_exp_unsigned_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto underflow, goto overflow);
/* (z, exp_z) = base^(exp_base-pstr_size) */
- z = result + 2*ysize + 1;
+ z = result + 2*ysize + 1;
err = mpfr_mpn_exp (z, &exp_z, pstr->base, exp_z, ysize);
exact = exact && (err == -1);
- if (err == -2)
- goto underflow; /* FIXME: Sure? */
+ if (err == -2)
+ goto underflow; /* FIXME: Sure? */
if (err == -1)
err = 0;
/* compute y / z */
/* result will be put into result + n, and remainder into result */
- mpn_tdiv_qr (result + ysize, result, (mp_size_t) 0, y,
- 2*ysize, z, ysize);
-
- /* exp -= exp_z + ysize_bits with overflow checking
- and check that we can add/substract 2 to exp without overflow */
- MPFR_SADD_OVERFLOW (exp_z, exp_z, ysize_bits,
- mp_exp_t, mp_exp_unsigned_t,
- MPFR_EXP_MIN, MPFR_EXP_MAX,
- goto underflow, goto overflow);
- MPFR_SADD_OVERFLOW (exp, exp, -exp_z,
- mp_exp_t, mp_exp_unsigned_t,
- MPFR_EXP_MIN+2, MPFR_EXP_MAX-2,
- goto overflow, goto underflow);
+ mpn_tdiv_qr (result + ysize, result, (mp_size_t) 0, y,
+ 2*ysize, z, ysize);
+
+ /* exp -= exp_z + ysize_bits with overflow checking
+ and check that we can add/substract 2 to exp without overflow */
+ MPFR_SADD_OVERFLOW (exp_z, exp_z, ysize_bits,
+ mp_exp_t, mp_exp_unsigned_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto underflow, goto overflow);
+ MPFR_SADD_OVERFLOW (exp, exp, -exp_z,
+ mp_exp_t, mp_exp_unsigned_t,
+ MPFR_EXP_MIN+2, MPFR_EXP_MAX-2,
+ goto overflow, goto underflow);
err += 2;
exact = exact && (mpn_popcount (result, ysize) == 0);
/* normalize result */
if (result[2 * ysize] == MPFR_LIMB_ONE)
{
- mp_limb_t *r = result + ysize;
+ mp_limb_t *r = result + ysize;
exact = exact && ((*r & MPFR_LIMB_ONE) == 0);
mpn_rshift (r, r, ysize + 1, 1);
- /* Overflow Checking not needed */
+ /* Overflow Checking not needed */
exp ++;
}
- result += ysize;
+ result += ysize;
}
/* case exp_base = pstr_size */
else
{
/* base^(exp_s-pr) = 1 nothing to compute */
result = y;
- err = 0;
+ err = 0;
}
/* test if rounding is possible, and if so exit the loop */
- if (exact || mpfr_can_round_raw (result, ysize,
- (pstr->negative) ? -1 : 1,
- ysize_bits - err - 1,
- GMP_RNDN, rnd, MPFR_PREC(x)))
+ if (exact || mpfr_can_round_raw (result, ysize,
+ (pstr->negative) ? -1 : 1,
+ ysize_bits - err - 1,
+ GMP_RNDN, rnd, MPFR_PREC(x)))
break;
/* update the prec for next loop */
@@ -635,8 +638,8 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd)
/* round y */
if (mpfr_round_raw (MPFR_MANT (x), result,
- ysize_bits,
- pstr->negative, MPFR_PREC(x), rnd, &res ))
+ ysize_bits,
+ pstr->negative, MPFR_PREC(x), rnd, &res ))
{
/* overflow when rounding y */
MPFR_MANT (x)[MPFR_LIMB_SIZE (x) - 1] = MPFR_LIMB_HIGHBIT;
@@ -649,26 +652,26 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mp_rnd_t rnd)
/* DO NOT USE MPFR_SET_EXP. The exp may be out of range! */
MPFR_SADD_OVERFLOW (exp, exp, ysize_bits,
- mp_exp_t, mp_exp_unsigned_t,
- MPFR_EXP_MIN, MPFR_EXP_MAX,
- goto overflow, goto underflow);
+ mp_exp_t, mp_exp_unsigned_t,
+ MPFR_EXP_MIN, MPFR_EXP_MAX,
+ goto overflow, goto underflow);
MPFR_EXP (x) = exp;
res = mpfr_check_range (x, res, rnd);
goto end;
underflow:
- /* This is called when there is a huge overflow
+ /* This is called when there is a huge overflow
(Real expo < MPFR_EXP_MIN << __gmpfr_emin */
if (rnd == GMP_RNDN)
rnd = GMP_RNDZ;
res = mpfr_set_underflow (x, rnd, (pstr->negative) ? -1 : 1);
goto end;
-
+
overflow:
res = mpfr_set_overflow (x, rnd, (pstr->negative) ? -1 : 1);
end:
- TMP_FREE (maker);
+ TMP_FREE (maker);
return res;
}
@@ -679,8 +682,8 @@ free_parsed_string (struct parsed_string *pstr)
}
int
-mpfr_strtofr (mpfr_t x, const char *string, char **end, unsigned int base,
- mp_rnd_t rnd)
+mpfr_strtofr (mpfr_t x, const char *string, char **end, int base,
+ mp_rnd_t rnd)
{
int res = -1;
struct parsed_string pstr;
@@ -689,26 +692,26 @@ mpfr_strtofr (mpfr_t x, const char *string, char **end, unsigned int base,
MPFR_SET_ZERO (x);
MPFR_SET_POS (x);
- if (base == 0 || (base >= 2 && base <= MPFR_MAX_BASE))
+ if (base == 0 || (base >= 2 && base <= /*MPFR_MAX_BASE*/36))
{
res = parse_string (x, &pstr, &string, base);
/* If res == 0, then it was exact (NAN or INF),
- so it is also the ternary value */
+ so it is also the ternary value */
if (res == 1)
- {
- res = parsed_string_to_mpfr (x, &pstr, rnd);
- free_parsed_string (&pstr);
- }
+ {
+ res = parsed_string_to_mpfr (x, &pstr, rnd);
+ free_parsed_string (&pstr);
+ }
else if (res == 2)
- res = mpfr_set_overflow (x, rnd, (pstr.negative) ? -1 : 1);
+ res = mpfr_set_overflow (x, rnd, (pstr.negative) ? -1 : 1);
else if (res == 3)
- {
- /* This is called when there is a huge overflow
- (Real expo < MPFR_EXP_MIN << __gmpfr_emin */
- if (rnd == GMP_RNDN)
- rnd = GMP_RNDZ;
- res = mpfr_set_underflow (x, rnd, (pstr.negative) ? -1 : 1);
- }
+ {
+ /* This is called when there is a huge overflow
+ (Real expo < MPFR_EXP_MIN << __gmpfr_emin */
+ if (rnd == GMP_RNDN)
+ rnd = GMP_RNDZ;
+ res = mpfr_set_underflow (x, rnd, (pstr.negative) ? -1 : 1);
+ }
}
if (end != NULL)
*end = (char *) string;
diff --git a/tests/Makefile.in b/tests/Makefile.in
deleted file mode 100644
index 4cdbe3005..000000000
--- a/tests/Makefile.in
+++ /dev/null
@@ -1,920 +0,0 @@
-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-
-# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-CC = @CC@
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
-MAKEINFO = @MAKEINFO@
-MISCFLAGS = @MISCFLAGS@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-VERSION = @VERSION@
-
-check_PROGRAMS = reuse tabs tadd tagm tcan_round tcmp tcmp2 tcmp_ui tdiv tdiv_ui tdump teq texp tget_str tlog tconst_log2 tmul tmul_2exp tmul_ui tout_str tconst_pi tpow trandom tround_prec tset_d tset_f tset_q tset_si tset_str tset_z tsqrt tsqrt_ui tui_div tui_sub tswap ttrunc trint tisnan tget_d tatan tcosh tsinh ttanh tacosh tasinh tatanh thyperbolic texp2 tfactorial tsub tasin tconst_euler tcos tsin ttan tsub_ui tset tlog1p texpm1 tlog2 tlog10 tui_pow tpow3 tadd_ui texceptions tfma thypot tacos
-EXTRA_DIST = tgeneric.c
-
-LDADD = $(top_builddir)/libmpfr.a @LDADD@
-INCLUDES = -I$(top_srcdir) @INCLUDES@
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_CLEAN_FILES =
-
-DEFS = @DEFS@ -I. -I$(srcdir)
-CPPFLAGS = @CPPFLAGS@
-LIBS = @LIBS@
-reuse_SOURCES = reuse.c
-reuse_OBJECTS = reuse.o
-reuse_LDADD = $(LDADD)
-reuse_DEPENDENCIES = $(top_builddir)/libmpfr.a
-reuse_LDFLAGS =
-tabs_SOURCES = tabs.c
-tabs_OBJECTS = tabs.o
-tabs_LDADD = $(LDADD)
-tabs_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tabs_LDFLAGS =
-tadd_SOURCES = tadd.c
-tadd_OBJECTS = tadd.o
-tadd_LDADD = $(LDADD)
-tadd_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tadd_LDFLAGS =
-tagm_SOURCES = tagm.c
-tagm_OBJECTS = tagm.o
-tagm_LDADD = $(LDADD)
-tagm_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tagm_LDFLAGS =
-tcan_round_SOURCES = tcan_round.c
-tcan_round_OBJECTS = tcan_round.o
-tcan_round_LDADD = $(LDADD)
-tcan_round_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tcan_round_LDFLAGS =
-tcmp_SOURCES = tcmp.c
-tcmp_OBJECTS = tcmp.o
-tcmp_LDADD = $(LDADD)
-tcmp_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tcmp_LDFLAGS =
-tcmp2_SOURCES = tcmp2.c
-tcmp2_OBJECTS = tcmp2.o
-tcmp2_LDADD = $(LDADD)
-tcmp2_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tcmp2_LDFLAGS =
-tcmp_ui_SOURCES = tcmp_ui.c
-tcmp_ui_OBJECTS = tcmp_ui.o
-tcmp_ui_LDADD = $(LDADD)
-tcmp_ui_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tcmp_ui_LDFLAGS =
-tdiv_SOURCES = tdiv.c
-tdiv_OBJECTS = tdiv.o
-tdiv_LDADD = $(LDADD)
-tdiv_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tdiv_LDFLAGS =
-tdiv_ui_SOURCES = tdiv_ui.c
-tdiv_ui_OBJECTS = tdiv_ui.o
-tdiv_ui_LDADD = $(LDADD)
-tdiv_ui_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tdiv_ui_LDFLAGS =
-tdump_SOURCES = tdump.c
-tdump_OBJECTS = tdump.o
-tdump_LDADD = $(LDADD)
-tdump_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tdump_LDFLAGS =
-teq_SOURCES = teq.c
-teq_OBJECTS = teq.o
-teq_LDADD = $(LDADD)
-teq_DEPENDENCIES = $(top_builddir)/libmpfr.a
-teq_LDFLAGS =
-texp_SOURCES = texp.c
-texp_OBJECTS = texp.o
-texp_LDADD = $(LDADD)
-texp_DEPENDENCIES = $(top_builddir)/libmpfr.a
-texp_LDFLAGS =
-tget_str_SOURCES = tget_str.c
-tget_str_OBJECTS = tget_str.o
-tget_str_LDADD = $(LDADD)
-tget_str_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tget_str_LDFLAGS =
-tlog_SOURCES = tlog.c
-tlog_OBJECTS = tlog.o
-tlog_LDADD = $(LDADD)
-tlog_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tlog_LDFLAGS =
-tconst_log2_SOURCES = tconst_log2.c
-tconst_log2_OBJECTS = tconst_log2.o
-tconst_log2_LDADD = $(LDADD)
-tconst_log2_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tconst_log2_LDFLAGS =
-tmul_SOURCES = tmul.c
-tmul_OBJECTS = tmul.o
-tmul_LDADD = $(LDADD)
-tmul_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tmul_LDFLAGS =
-tmul_2exp_SOURCES = tmul_2exp.c
-tmul_2exp_OBJECTS = tmul_2exp.o
-tmul_2exp_LDADD = $(LDADD)
-tmul_2exp_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tmul_2exp_LDFLAGS =
-tmul_ui_SOURCES = tmul_ui.c
-tmul_ui_OBJECTS = tmul_ui.o
-tmul_ui_LDADD = $(LDADD)
-tmul_ui_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tmul_ui_LDFLAGS =
-tout_str_SOURCES = tout_str.c
-tout_str_OBJECTS = tout_str.o
-tout_str_LDADD = $(LDADD)
-tout_str_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tout_str_LDFLAGS =
-tconst_pi_SOURCES = tconst_pi.c
-tconst_pi_OBJECTS = tconst_pi.o
-tconst_pi_LDADD = $(LDADD)
-tconst_pi_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tconst_pi_LDFLAGS =
-tpow_SOURCES = tpow.c
-tpow_OBJECTS = tpow.o
-tpow_LDADD = $(LDADD)
-tpow_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tpow_LDFLAGS =
-trandom_SOURCES = trandom.c
-trandom_OBJECTS = trandom.o
-trandom_LDADD = $(LDADD)
-trandom_DEPENDENCIES = $(top_builddir)/libmpfr.a
-trandom_LDFLAGS =
-tround_prec_SOURCES = tround_prec.c
-tround_prec_OBJECTS = tround_prec.o
-tround_prec_LDADD = $(LDADD)
-tround_prec_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tround_prec_LDFLAGS =
-tset_d_SOURCES = tset_d.c
-tset_d_OBJECTS = tset_d.o
-tset_d_LDADD = $(LDADD)
-tset_d_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tset_d_LDFLAGS =
-tset_f_SOURCES = tset_f.c
-tset_f_OBJECTS = tset_f.o
-tset_f_LDADD = $(LDADD)
-tset_f_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tset_f_LDFLAGS =
-tset_q_SOURCES = tset_q.c
-tset_q_OBJECTS = tset_q.o
-tset_q_LDADD = $(LDADD)
-tset_q_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tset_q_LDFLAGS =
-tset_si_SOURCES = tset_si.c
-tset_si_OBJECTS = tset_si.o
-tset_si_LDADD = $(LDADD)
-tset_si_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tset_si_LDFLAGS =
-tset_str_SOURCES = tset_str.c
-tset_str_OBJECTS = tset_str.o
-tset_str_LDADD = $(LDADD)
-tset_str_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tset_str_LDFLAGS =
-tset_z_SOURCES = tset_z.c
-tset_z_OBJECTS = tset_z.o
-tset_z_LDADD = $(LDADD)
-tset_z_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tset_z_LDFLAGS =
-tsqrt_SOURCES = tsqrt.c
-tsqrt_OBJECTS = tsqrt.o
-tsqrt_LDADD = $(LDADD)
-tsqrt_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tsqrt_LDFLAGS =
-tsqrt_ui_SOURCES = tsqrt_ui.c
-tsqrt_ui_OBJECTS = tsqrt_ui.o
-tsqrt_ui_LDADD = $(LDADD)
-tsqrt_ui_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tsqrt_ui_LDFLAGS =
-tui_div_SOURCES = tui_div.c
-tui_div_OBJECTS = tui_div.o
-tui_div_LDADD = $(LDADD)
-tui_div_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tui_div_LDFLAGS =
-tui_sub_SOURCES = tui_sub.c
-tui_sub_OBJECTS = tui_sub.o
-tui_sub_LDADD = $(LDADD)
-tui_sub_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tui_sub_LDFLAGS =
-tswap_SOURCES = tswap.c
-tswap_OBJECTS = tswap.o
-tswap_LDADD = $(LDADD)
-tswap_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tswap_LDFLAGS =
-ttrunc_SOURCES = ttrunc.c
-ttrunc_OBJECTS = ttrunc.o
-ttrunc_LDADD = $(LDADD)
-ttrunc_DEPENDENCIES = $(top_builddir)/libmpfr.a
-ttrunc_LDFLAGS =
-trint_SOURCES = trint.c
-trint_OBJECTS = trint.o
-trint_LDADD = $(LDADD)
-trint_DEPENDENCIES = $(top_builddir)/libmpfr.a
-trint_LDFLAGS =
-tisnan_SOURCES = tisnan.c
-tisnan_OBJECTS = tisnan.o
-tisnan_LDADD = $(LDADD)
-tisnan_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tisnan_LDFLAGS =
-tget_d_SOURCES = tget_d.c
-tget_d_OBJECTS = tget_d.o
-tget_d_LDADD = $(LDADD)
-tget_d_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tget_d_LDFLAGS =
-tatan_SOURCES = tatan.c
-tatan_OBJECTS = tatan.o
-tatan_LDADD = $(LDADD)
-tatan_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tatan_LDFLAGS =
-tcosh_SOURCES = tcosh.c
-tcosh_OBJECTS = tcosh.o
-tcosh_LDADD = $(LDADD)
-tcosh_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tcosh_LDFLAGS =
-tsinh_SOURCES = tsinh.c
-tsinh_OBJECTS = tsinh.o
-tsinh_LDADD = $(LDADD)
-tsinh_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tsinh_LDFLAGS =
-ttanh_SOURCES = ttanh.c
-ttanh_OBJECTS = ttanh.o
-ttanh_LDADD = $(LDADD)
-ttanh_DEPENDENCIES = $(top_builddir)/libmpfr.a
-ttanh_LDFLAGS =
-tacosh_SOURCES = tacosh.c
-tacosh_OBJECTS = tacosh.o
-tacosh_LDADD = $(LDADD)
-tacosh_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tacosh_LDFLAGS =
-tasinh_SOURCES = tasinh.c
-tasinh_OBJECTS = tasinh.o
-tasinh_LDADD = $(LDADD)
-tasinh_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tasinh_LDFLAGS =
-tatanh_SOURCES = tatanh.c
-tatanh_OBJECTS = tatanh.o
-tatanh_LDADD = $(LDADD)
-tatanh_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tatanh_LDFLAGS =
-thyperbolic_SOURCES = thyperbolic.c
-thyperbolic_OBJECTS = thyperbolic.o
-thyperbolic_LDADD = $(LDADD)
-thyperbolic_DEPENDENCIES = $(top_builddir)/libmpfr.a
-thyperbolic_LDFLAGS =
-texp2_SOURCES = texp2.c
-texp2_OBJECTS = texp2.o
-texp2_LDADD = $(LDADD)
-texp2_DEPENDENCIES = $(top_builddir)/libmpfr.a
-texp2_LDFLAGS =
-tfactorial_SOURCES = tfactorial.c
-tfactorial_OBJECTS = tfactorial.o
-tfactorial_LDADD = $(LDADD)
-tfactorial_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tfactorial_LDFLAGS =
-tsub_SOURCES = tsub.c
-tsub_OBJECTS = tsub.o
-tsub_LDADD = $(LDADD)
-tsub_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tsub_LDFLAGS =
-tasin_SOURCES = tasin.c
-tasin_OBJECTS = tasin.o
-tasin_LDADD = $(LDADD)
-tasin_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tasin_LDFLAGS =
-tconst_euler_SOURCES = tconst_euler.c
-tconst_euler_OBJECTS = tconst_euler.o
-tconst_euler_LDADD = $(LDADD)
-tconst_euler_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tconst_euler_LDFLAGS =
-tcos_SOURCES = tcos.c
-tcos_OBJECTS = tcos.o
-tcos_LDADD = $(LDADD)
-tcos_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tcos_LDFLAGS =
-tsin_SOURCES = tsin.c
-tsin_OBJECTS = tsin.o
-tsin_LDADD = $(LDADD)
-tsin_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tsin_LDFLAGS =
-ttan_SOURCES = ttan.c
-ttan_OBJECTS = ttan.o
-ttan_LDADD = $(LDADD)
-ttan_DEPENDENCIES = $(top_builddir)/libmpfr.a
-ttan_LDFLAGS =
-tsub_ui_SOURCES = tsub_ui.c
-tsub_ui_OBJECTS = tsub_ui.o
-tsub_ui_LDADD = $(LDADD)
-tsub_ui_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tsub_ui_LDFLAGS =
-tset_SOURCES = tset.c
-tset_OBJECTS = tset.o
-tset_LDADD = $(LDADD)
-tset_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tset_LDFLAGS =
-tlog1p_SOURCES = tlog1p.c
-tlog1p_OBJECTS = tlog1p.o
-tlog1p_LDADD = $(LDADD)
-tlog1p_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tlog1p_LDFLAGS =
-texpm1_SOURCES = texpm1.c
-texpm1_OBJECTS = texpm1.o
-texpm1_LDADD = $(LDADD)
-texpm1_DEPENDENCIES = $(top_builddir)/libmpfr.a
-texpm1_LDFLAGS =
-tlog2_SOURCES = tlog2.c
-tlog2_OBJECTS = tlog2.o
-tlog2_LDADD = $(LDADD)
-tlog2_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tlog2_LDFLAGS =
-tlog10_SOURCES = tlog10.c
-tlog10_OBJECTS = tlog10.o
-tlog10_LDADD = $(LDADD)
-tlog10_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tlog10_LDFLAGS =
-tui_pow_SOURCES = tui_pow.c
-tui_pow_OBJECTS = tui_pow.o
-tui_pow_LDADD = $(LDADD)
-tui_pow_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tui_pow_LDFLAGS =
-tpow3_SOURCES = tpow3.c
-tpow3_OBJECTS = tpow3.o
-tpow3_LDADD = $(LDADD)
-tpow3_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tpow3_LDFLAGS =
-tadd_ui_SOURCES = tadd_ui.c
-tadd_ui_OBJECTS = tadd_ui.o
-tadd_ui_LDADD = $(LDADD)
-tadd_ui_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tadd_ui_LDFLAGS =
-texceptions_SOURCES = texceptions.c
-texceptions_OBJECTS = texceptions.o
-texceptions_LDADD = $(LDADD)
-texceptions_DEPENDENCIES = $(top_builddir)/libmpfr.a
-texceptions_LDFLAGS =
-tfma_SOURCES = tfma.c
-tfma_OBJECTS = tfma.o
-tfma_LDADD = $(LDADD)
-tfma_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tfma_LDFLAGS =
-thypot_SOURCES = thypot.c
-thypot_OBJECTS = thypot.o
-thypot_LDADD = $(LDADD)
-thypot_DEPENDENCIES = $(top_builddir)/libmpfr.a
-thypot_LDFLAGS =
-tacos_SOURCES = tacos.c
-tacos_OBJECTS = tacos.o
-tacos_LDADD = $(LDADD)
-tacos_DEPENDENCIES = $(top_builddir)/libmpfr.a
-tacos_LDFLAGS =
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-DIST_COMMON = Makefile.am Makefile.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = gtar
-GZIP_ENV = --best
-DEP_FILES = .deps/reuse.P .deps/tabs.P .deps/tacos.P .deps/tacosh.P \
-.deps/tadd.P .deps/tadd_ui.P .deps/tagm.P .deps/tasin.P .deps/tasinh.P \
-.deps/tatan.P .deps/tatanh.P .deps/tcan_round.P .deps/tcmp.P \
-.deps/tcmp2.P .deps/tcmp_ui.P .deps/tconst_euler.P .deps/tconst_log2.P \
-.deps/tconst_pi.P .deps/tcos.P .deps/tcosh.P .deps/tdiv.P \
-.deps/tdiv_ui.P .deps/tdump.P .deps/teq.P .deps/texceptions.P \
-.deps/texp.P .deps/texp2.P .deps/texpm1.P .deps/tfactorial.P \
-.deps/tfma.P .deps/tget_d.P .deps/tget_str.P .deps/thyperbolic.P \
-.deps/thypot.P .deps/tisnan.P .deps/tlog.P .deps/tlog10.P \
-.deps/tlog1p.P .deps/tlog2.P .deps/tmul.P .deps/tmul_2exp.P \
-.deps/tmul_ui.P .deps/tout_str.P .deps/tpow.P .deps/tpow3.P \
-.deps/trandom.P .deps/trint.P .deps/tround_prec.P .deps/tset.P \
-.deps/tset_d.P .deps/tset_f.P .deps/tset_q.P .deps/tset_si.P \
-.deps/tset_str.P .deps/tset_z.P .deps/tsin.P .deps/tsinh.P \
-.deps/tsqrt.P .deps/tsqrt_ui.P .deps/tsub.P .deps/tsub_ui.P \
-.deps/tswap.P .deps/ttan.P .deps/ttanh.P .deps/ttrunc.P .deps/tui_div.P \
-.deps/tui_pow.P .deps/tui_sub.P
-SOURCES = reuse.c tabs.c tadd.c tagm.c tcan_round.c tcmp.c tcmp2.c tcmp_ui.c tdiv.c tdiv_ui.c tdump.c teq.c texp.c tget_str.c tlog.c tconst_log2.c tmul.c tmul_2exp.c tmul_ui.c tout_str.c tconst_pi.c tpow.c trandom.c tround_prec.c tset_d.c tset_f.c tset_q.c tset_si.c tset_str.c tset_z.c tsqrt.c tsqrt_ui.c tui_div.c tui_sub.c tswap.c ttrunc.c trint.c tisnan.c tget_d.c tatan.c tcosh.c tsinh.c ttanh.c tacosh.c tasinh.c tatanh.c thyperbolic.c texp2.c tfactorial.c tsub.c tasin.c tconst_euler.c tcos.c tsin.c ttan.c tsub_ui.c tset.c tlog1p.c texpm1.c tlog2.c tlog10.c tui_pow.c tpow3.c tadd_ui.c texceptions.c tfma.c thypot.c tacos.c
-OBJECTS = reuse.o tabs.o tadd.o tagm.o tcan_round.o tcmp.o tcmp2.o tcmp_ui.o tdiv.o tdiv_ui.o tdump.o teq.o texp.o tget_str.o tlog.o tconst_log2.o tmul.o tmul_2exp.o tmul_ui.o tout_str.o tconst_pi.o tpow.o trandom.o tround_prec.o tset_d.o tset_f.o tset_q.o tset_si.o tset_str.o tset_z.o tsqrt.o tsqrt_ui.o tui_div.o tui_sub.o tswap.o ttrunc.o trint.o tisnan.o tget_d.o tatan.o tcosh.o tsinh.o ttanh.o tacosh.o tasinh.o tatanh.o thyperbolic.o texp2.o tfactorial.o tsub.o tasin.o tconst_euler.o tcos.o tsin.o ttan.o tsub_ui.o tset.o tlog1p.o texpm1.o tlog2.o tlog10.o tui_pow.o tpow3.o tadd_ui.o texceptions.o tfma.o thypot.o tacos.o
-
-all: all-redirect
-.SUFFIXES:
-.SUFFIXES: .S .c .o .s
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-
-mostlyclean-checkPROGRAMS:
-
-clean-checkPROGRAMS:
- -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
-
-distclean-checkPROGRAMS:
-
-maintainer-clean-checkPROGRAMS:
-
-.s.o:
- $(COMPILE) -c $<
-
-.S.o:
- $(COMPILE) -c $<
-
-mostlyclean-compile:
- -rm -f *.o core *.core
-
-clean-compile:
-
-distclean-compile:
- -rm -f *.tab.c
-
-maintainer-clean-compile:
-
-reuse: $(reuse_OBJECTS) $(reuse_DEPENDENCIES)
- @rm -f reuse
- $(LINK) $(reuse_LDFLAGS) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
-
-tabs: $(tabs_OBJECTS) $(tabs_DEPENDENCIES)
- @rm -f tabs
- $(LINK) $(tabs_LDFLAGS) $(tabs_OBJECTS) $(tabs_LDADD) $(LIBS)
-
-tadd: $(tadd_OBJECTS) $(tadd_DEPENDENCIES)
- @rm -f tadd
- $(LINK) $(tadd_LDFLAGS) $(tadd_OBJECTS) $(tadd_LDADD) $(LIBS)
-
-tagm: $(tagm_OBJECTS) $(tagm_DEPENDENCIES)
- @rm -f tagm
- $(LINK) $(tagm_LDFLAGS) $(tagm_OBJECTS) $(tagm_LDADD) $(LIBS)
-
-tcan_round: $(tcan_round_OBJECTS) $(tcan_round_DEPENDENCIES)
- @rm -f tcan_round
- $(LINK) $(tcan_round_LDFLAGS) $(tcan_round_OBJECTS) $(tcan_round_LDADD) $(LIBS)
-
-tcmp: $(tcmp_OBJECTS) $(tcmp_DEPENDENCIES)
- @rm -f tcmp
- $(LINK) $(tcmp_LDFLAGS) $(tcmp_OBJECTS) $(tcmp_LDADD) $(LIBS)
-
-tcmp2: $(tcmp2_OBJECTS) $(tcmp2_DEPENDENCIES)
- @rm -f tcmp2
- $(LINK) $(tcmp2_LDFLAGS) $(tcmp2_OBJECTS) $(tcmp2_LDADD) $(LIBS)
-
-tcmp_ui: $(tcmp_ui_OBJECTS) $(tcmp_ui_DEPENDENCIES)
- @rm -f tcmp_ui
- $(LINK) $(tcmp_ui_LDFLAGS) $(tcmp_ui_OBJECTS) $(tcmp_ui_LDADD) $(LIBS)
-
-tdiv: $(tdiv_OBJECTS) $(tdiv_DEPENDENCIES)
- @rm -f tdiv
- $(LINK) $(tdiv_LDFLAGS) $(tdiv_OBJECTS) $(tdiv_LDADD) $(LIBS)
-
-tdiv_ui: $(tdiv_ui_OBJECTS) $(tdiv_ui_DEPENDENCIES)
- @rm -f tdiv_ui
- $(LINK) $(tdiv_ui_LDFLAGS) $(tdiv_ui_OBJECTS) $(tdiv_ui_LDADD) $(LIBS)
-
-tdump: $(tdump_OBJECTS) $(tdump_DEPENDENCIES)
- @rm -f tdump
- $(LINK) $(tdump_LDFLAGS) $(tdump_OBJECTS) $(tdump_LDADD) $(LIBS)
-
-teq: $(teq_OBJECTS) $(teq_DEPENDENCIES)
- @rm -f teq
- $(LINK) $(teq_LDFLAGS) $(teq_OBJECTS) $(teq_LDADD) $(LIBS)
-
-texp: $(texp_OBJECTS) $(texp_DEPENDENCIES)
- @rm -f texp
- $(LINK) $(texp_LDFLAGS) $(texp_OBJECTS) $(texp_LDADD) $(LIBS)
-
-tget_str: $(tget_str_OBJECTS) $(tget_str_DEPENDENCIES)
- @rm -f tget_str
- $(LINK) $(tget_str_LDFLAGS) $(tget_str_OBJECTS) $(tget_str_LDADD) $(LIBS)
-
-tlog: $(tlog_OBJECTS) $(tlog_DEPENDENCIES)
- @rm -f tlog
- $(LINK) $(tlog_LDFLAGS) $(tlog_OBJECTS) $(tlog_LDADD) $(LIBS)
-
-tconst_log2: $(tconst_log2_OBJECTS) $(tconst_log2_DEPENDENCIES)
- @rm -f tconst_log2
- $(LINK) $(tconst_log2_LDFLAGS) $(tconst_log2_OBJECTS) $(tconst_log2_LDADD) $(LIBS)
-
-tmul: $(tmul_OBJECTS) $(tmul_DEPENDENCIES)
- @rm -f tmul
- $(LINK) $(tmul_LDFLAGS) $(tmul_OBJECTS) $(tmul_LDADD) $(LIBS)
-
-tmul_2exp: $(tmul_2exp_OBJECTS) $(tmul_2exp_DEPENDENCIES)
- @rm -f tmul_2exp
- $(LINK) $(tmul_2exp_LDFLAGS) $(tmul_2exp_OBJECTS) $(tmul_2exp_LDADD) $(LIBS)
-
-tmul_ui: $(tmul_ui_OBJECTS) $(tmul_ui_DEPENDENCIES)
- @rm -f tmul_ui
- $(LINK) $(tmul_ui_LDFLAGS) $(tmul_ui_OBJECTS) $(tmul_ui_LDADD) $(LIBS)
-
-tout_str: $(tout_str_OBJECTS) $(tout_str_DEPENDENCIES)
- @rm -f tout_str
- $(LINK) $(tout_str_LDFLAGS) $(tout_str_OBJECTS) $(tout_str_LDADD) $(LIBS)
-
-tconst_pi: $(tconst_pi_OBJECTS) $(tconst_pi_DEPENDENCIES)
- @rm -f tconst_pi
- $(LINK) $(tconst_pi_LDFLAGS) $(tconst_pi_OBJECTS) $(tconst_pi_LDADD) $(LIBS)
-
-tpow: $(tpow_OBJECTS) $(tpow_DEPENDENCIES)
- @rm -f tpow
- $(LINK) $(tpow_LDFLAGS) $(tpow_OBJECTS) $(tpow_LDADD) $(LIBS)
-
-trandom: $(trandom_OBJECTS) $(trandom_DEPENDENCIES)
- @rm -f trandom
- $(LINK) $(trandom_LDFLAGS) $(trandom_OBJECTS) $(trandom_LDADD) $(LIBS)
-
-tround_prec: $(tround_prec_OBJECTS) $(tround_prec_DEPENDENCIES)
- @rm -f tround_prec
- $(LINK) $(tround_prec_LDFLAGS) $(tround_prec_OBJECTS) $(tround_prec_LDADD) $(LIBS)
-
-tset_d: $(tset_d_OBJECTS) $(tset_d_DEPENDENCIES)
- @rm -f tset_d
- $(LINK) $(tset_d_LDFLAGS) $(tset_d_OBJECTS) $(tset_d_LDADD) $(LIBS)
-
-tset_f: $(tset_f_OBJECTS) $(tset_f_DEPENDENCIES)
- @rm -f tset_f
- $(LINK) $(tset_f_LDFLAGS) $(tset_f_OBJECTS) $(tset_f_LDADD) $(LIBS)
-
-tset_q: $(tset_q_OBJECTS) $(tset_q_DEPENDENCIES)
- @rm -f tset_q
- $(LINK) $(tset_q_LDFLAGS) $(tset_q_OBJECTS) $(tset_q_LDADD) $(LIBS)
-
-tset_si: $(tset_si_OBJECTS) $(tset_si_DEPENDENCIES)
- @rm -f tset_si
- $(LINK) $(tset_si_LDFLAGS) $(tset_si_OBJECTS) $(tset_si_LDADD) $(LIBS)
-
-tset_str: $(tset_str_OBJECTS) $(tset_str_DEPENDENCIES)
- @rm -f tset_str
- $(LINK) $(tset_str_LDFLAGS) $(tset_str_OBJECTS) $(tset_str_LDADD) $(LIBS)
-
-tset_z: $(tset_z_OBJECTS) $(tset_z_DEPENDENCIES)
- @rm -f tset_z
- $(LINK) $(tset_z_LDFLAGS) $(tset_z_OBJECTS) $(tset_z_LDADD) $(LIBS)
-
-tsqrt: $(tsqrt_OBJECTS) $(tsqrt_DEPENDENCIES)
- @rm -f tsqrt
- $(LINK) $(tsqrt_LDFLAGS) $(tsqrt_OBJECTS) $(tsqrt_LDADD) $(LIBS)
-
-tsqrt_ui: $(tsqrt_ui_OBJECTS) $(tsqrt_ui_DEPENDENCIES)
- @rm -f tsqrt_ui
- $(LINK) $(tsqrt_ui_LDFLAGS) $(tsqrt_ui_OBJECTS) $(tsqrt_ui_LDADD) $(LIBS)
-
-tui_div: $(tui_div_OBJECTS) $(tui_div_DEPENDENCIES)
- @rm -f tui_div
- $(LINK) $(tui_div_LDFLAGS) $(tui_div_OBJECTS) $(tui_div_LDADD) $(LIBS)
-
-tui_sub: $(tui_sub_OBJECTS) $(tui_sub_DEPENDENCIES)
- @rm -f tui_sub
- $(LINK) $(tui_sub_LDFLAGS) $(tui_sub_OBJECTS) $(tui_sub_LDADD) $(LIBS)
-
-tswap: $(tswap_OBJECTS) $(tswap_DEPENDENCIES)
- @rm -f tswap
- $(LINK) $(tswap_LDFLAGS) $(tswap_OBJECTS) $(tswap_LDADD) $(LIBS)
-
-ttrunc: $(ttrunc_OBJECTS) $(ttrunc_DEPENDENCIES)
- @rm -f ttrunc
- $(LINK) $(ttrunc_LDFLAGS) $(ttrunc_OBJECTS) $(ttrunc_LDADD) $(LIBS)
-
-trint: $(trint_OBJECTS) $(trint_DEPENDENCIES)
- @rm -f trint
- $(LINK) $(trint_LDFLAGS) $(trint_OBJECTS) $(trint_LDADD) $(LIBS)
-
-tisnan: $(tisnan_OBJECTS) $(tisnan_DEPENDENCIES)
- @rm -f tisnan
- $(LINK) $(tisnan_LDFLAGS) $(tisnan_OBJECTS) $(tisnan_LDADD) $(LIBS)
-
-tget_d: $(tget_d_OBJECTS) $(tget_d_DEPENDENCIES)
- @rm -f tget_d
- $(LINK) $(tget_d_LDFLAGS) $(tget_d_OBJECTS) $(tget_d_LDADD) $(LIBS)
-
-tatan: $(tatan_OBJECTS) $(tatan_DEPENDENCIES)
- @rm -f tatan
- $(LINK) $(tatan_LDFLAGS) $(tatan_OBJECTS) $(tatan_LDADD) $(LIBS)
-
-tcosh: $(tcosh_OBJECTS) $(tcosh_DEPENDENCIES)
- @rm -f tcosh
- $(LINK) $(tcosh_LDFLAGS) $(tcosh_OBJECTS) $(tcosh_LDADD) $(LIBS)
-
-tsinh: $(tsinh_OBJECTS) $(tsinh_DEPENDENCIES)
- @rm -f tsinh
- $(LINK) $(tsinh_LDFLAGS) $(tsinh_OBJECTS) $(tsinh_LDADD) $(LIBS)
-
-ttanh: $(ttanh_OBJECTS) $(ttanh_DEPENDENCIES)
- @rm -f ttanh
- $(LINK) $(ttanh_LDFLAGS) $(ttanh_OBJECTS) $(ttanh_LDADD) $(LIBS)
-
-tacosh: $(tacosh_OBJECTS) $(tacosh_DEPENDENCIES)
- @rm -f tacosh
- $(LINK) $(tacosh_LDFLAGS) $(tacosh_OBJECTS) $(tacosh_LDADD) $(LIBS)
-
-tasinh: $(tasinh_OBJECTS) $(tasinh_DEPENDENCIES)
- @rm -f tasinh
- $(LINK) $(tasinh_LDFLAGS) $(tasinh_OBJECTS) $(tasinh_LDADD) $(LIBS)
-
-tatanh: $(tatanh_OBJECTS) $(tatanh_DEPENDENCIES)
- @rm -f tatanh
- $(LINK) $(tatanh_LDFLAGS) $(tatanh_OBJECTS) $(tatanh_LDADD) $(LIBS)
-
-thyperbolic: $(thyperbolic_OBJECTS) $(thyperbolic_DEPENDENCIES)
- @rm -f thyperbolic
- $(LINK) $(thyperbolic_LDFLAGS) $(thyperbolic_OBJECTS) $(thyperbolic_LDADD) $(LIBS)
-
-texp2: $(texp2_OBJECTS) $(texp2_DEPENDENCIES)
- @rm -f texp2
- $(LINK) $(texp2_LDFLAGS) $(texp2_OBJECTS) $(texp2_LDADD) $(LIBS)
-
-tfactorial: $(tfactorial_OBJECTS) $(tfactorial_DEPENDENCIES)
- @rm -f tfactorial
- $(LINK) $(tfactorial_LDFLAGS) $(tfactorial_OBJECTS) $(tfactorial_LDADD) $(LIBS)
-
-tsub: $(tsub_OBJECTS) $(tsub_DEPENDENCIES)
- @rm -f tsub
- $(LINK) $(tsub_LDFLAGS) $(tsub_OBJECTS) $(tsub_LDADD) $(LIBS)
-
-tasin: $(tasin_OBJECTS) $(tasin_DEPENDENCIES)
- @rm -f tasin
- $(LINK) $(tasin_LDFLAGS) $(tasin_OBJECTS) $(tasin_LDADD) $(LIBS)
-
-tconst_euler: $(tconst_euler_OBJECTS) $(tconst_euler_DEPENDENCIES)
- @rm -f tconst_euler
- $(LINK) $(tconst_euler_LDFLAGS) $(tconst_euler_OBJECTS) $(tconst_euler_LDADD) $(LIBS)
-
-tcos: $(tcos_OBJECTS) $(tcos_DEPENDENCIES)
- @rm -f tcos
- $(LINK) $(tcos_LDFLAGS) $(tcos_OBJECTS) $(tcos_LDADD) $(LIBS)
-
-tsin: $(tsin_OBJECTS) $(tsin_DEPENDENCIES)
- @rm -f tsin
- $(LINK) $(tsin_LDFLAGS) $(tsin_OBJECTS) $(tsin_LDADD) $(LIBS)
-
-ttan: $(ttan_OBJECTS) $(ttan_DEPENDENCIES)
- @rm -f ttan
- $(LINK) $(ttan_LDFLAGS) $(ttan_OBJECTS) $(ttan_LDADD) $(LIBS)
-
-tsub_ui: $(tsub_ui_OBJECTS) $(tsub_ui_DEPENDENCIES)
- @rm -f tsub_ui
- $(LINK) $(tsub_ui_LDFLAGS) $(tsub_ui_OBJECTS) $(tsub_ui_LDADD) $(LIBS)
-
-tset: $(tset_OBJECTS) $(tset_DEPENDENCIES)
- @rm -f tset
- $(LINK) $(tset_LDFLAGS) $(tset_OBJECTS) $(tset_LDADD) $(LIBS)
-
-tlog1p: $(tlog1p_OBJECTS) $(tlog1p_DEPENDENCIES)
- @rm -f tlog1p
- $(LINK) $(tlog1p_LDFLAGS) $(tlog1p_OBJECTS) $(tlog1p_LDADD) $(LIBS)
-
-texpm1: $(texpm1_OBJECTS) $(texpm1_DEPENDENCIES)
- @rm -f texpm1
- $(LINK) $(texpm1_LDFLAGS) $(texpm1_OBJECTS) $(texpm1_LDADD) $(LIBS)
-
-tlog2: $(tlog2_OBJECTS) $(tlog2_DEPENDENCIES)
- @rm -f tlog2
- $(LINK) $(tlog2_LDFLAGS) $(tlog2_OBJECTS) $(tlog2_LDADD) $(LIBS)
-
-tlog10: $(tlog10_OBJECTS) $(tlog10_DEPENDENCIES)
- @rm -f tlog10
- $(LINK) $(tlog10_LDFLAGS) $(tlog10_OBJECTS) $(tlog10_LDADD) $(LIBS)
-
-tui_pow: $(tui_pow_OBJECTS) $(tui_pow_DEPENDENCIES)
- @rm -f tui_pow
- $(LINK) $(tui_pow_LDFLAGS) $(tui_pow_OBJECTS) $(tui_pow_LDADD) $(LIBS)
-
-tpow3: $(tpow3_OBJECTS) $(tpow3_DEPENDENCIES)
- @rm -f tpow3
- $(LINK) $(tpow3_LDFLAGS) $(tpow3_OBJECTS) $(tpow3_LDADD) $(LIBS)
-
-tadd_ui: $(tadd_ui_OBJECTS) $(tadd_ui_DEPENDENCIES)
- @rm -f tadd_ui
- $(LINK) $(tadd_ui_LDFLAGS) $(tadd_ui_OBJECTS) $(tadd_ui_LDADD) $(LIBS)
-
-texceptions: $(texceptions_OBJECTS) $(texceptions_DEPENDENCIES)
- @rm -f texceptions
- $(LINK) $(texceptions_LDFLAGS) $(texceptions_OBJECTS) $(texceptions_LDADD) $(LIBS)
-
-tfma: $(tfma_OBJECTS) $(tfma_DEPENDENCIES)
- @rm -f tfma
- $(LINK) $(tfma_LDFLAGS) $(tfma_OBJECTS) $(tfma_LDADD) $(LIBS)
-
-thypot: $(thypot_OBJECTS) $(thypot_DEPENDENCIES)
- @rm -f thypot
- $(LINK) $(thypot_LDFLAGS) $(thypot_OBJECTS) $(thypot_LDADD) $(LIBS)
-
-tacos: $(tacos_OBJECTS) $(tacos_DEPENDENCIES)
- @rm -f tacos
- $(LINK) $(tacos_LDFLAGS) $(tacos_OBJECTS) $(tacos_LDADD) $(LIBS)
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP)
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $$unique $(LISP)
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
-
-clean-tags:
-
-distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = tests
-
-distdir: $(DISTFILES)
- here=`cd $(top_builddir) && pwd`; \
- top_distdir=`cd $(top_distdir) && pwd`; \
- distdir=`cd $(distdir) && pwd`; \
- cd $(top_srcdir) \
- && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu tests/Makefile
- @for file in $(DISTFILES); do \
- d=$(srcdir); \
- if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
- else \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
- fi; \
- done
-
-DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
-
--include $(DEP_FILES)
-
-mostlyclean-depend:
-
-clean-depend:
-
-distclean-depend:
- -rm -rf .deps
-
-maintainer-clean-depend:
-
-%.o: %.c
- @echo '$(COMPILE) -c $<'; \
- $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
- @-cp .deps/$(*F).pp .deps/$(*F).P; \
- tr ' ' '\012' < .deps/$(*F).pp \
- | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
- >> .deps/$(*F).P; \
- rm .deps/$(*F).pp
-
-%.lo: %.c
- @echo '$(LTCOMPILE) -c $<'; \
- $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
- @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
- < .deps/$(*F).pp > .deps/$(*F).P; \
- tr ' ' '\012' < .deps/$(*F).pp \
- | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
- >> .deps/$(*F).P; \
- rm -f .deps/$(*F).pp
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
-check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
-check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-exec-am:
-install-exec: install-exec-am
-
-install-data-am:
-install-data: install-data-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am:
-uninstall: uninstall-am
-all-am: Makefile
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
-
-
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-
-maintainer-clean-generic:
-mostlyclean-am: mostlyclean-checkPROGRAMS mostlyclean-compile \
- mostlyclean-tags mostlyclean-depend mostlyclean-generic
-
-mostlyclean: mostlyclean-am
-
-clean-am: clean-checkPROGRAMS clean-compile clean-tags clean-depend \
- clean-generic mostlyclean-am
-
-clean: clean-am
-
-distclean-am: distclean-checkPROGRAMS distclean-compile distclean-tags \
- distclean-depend distclean-generic clean-am
-
-distclean: distclean-am
-
-maintainer-clean-am: maintainer-clean-checkPROGRAMS \
- maintainer-clean-compile maintainer-clean-tags \
- maintainer-clean-depend maintainer-clean-generic \
- distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-am
-
-.PHONY: mostlyclean-checkPROGRAMS distclean-checkPROGRAMS \
-clean-checkPROGRAMS maintainer-clean-checkPROGRAMS mostlyclean-compile \
-distclean-compile clean-compile maintainer-clean-compile tags \
-mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
-distdir mostlyclean-depend distclean-depend clean-depend \
-maintainer-clean-depend info-am info dvi-am dvi check check-am \
-installcheck-am installcheck install-exec-am install-exec \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
-
-
-../libmpfr.a:
- cd $(top_srcdir); make libmpfr.a
-
-check: all
- for i in $(check_PROGRAMS); do echo Testing $$i ; ./$$i || echo "### $$i failed ###"; done
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/tests/mpf_compat.h b/tests/mpf_compat.h
index 04f047efd..07ddfcf33 100644
--- a/tests/mpf_compat.h
+++ b/tests/mpf_compat.h
@@ -1,6 +1,6 @@
/* Test compatibility mpf-mpfr.
-Copyright 2003 Free Software Foundation.
+Copyright 2003, 2004 Free Software Foundation.
This file is part of the MPFR Library.
@@ -160,19 +160,28 @@ main ()
/* Input and Output Functions */
f = fopen ("/dev/null", "w");
- mpf_out_str (f, 10, 10, x);
- fclose (f);
+ if (f != NULL)
+ {
+ mpf_out_str (f, 10, 10, x);
+ fclose (f);
+ }
mpf_set_prec (x, 15);
mpf_set_prec (y, 15);
+ /* We may use src_fopen instead of fopen, but it is defined
+ in mpfr-test, and not in mpfr.h and gmp.h, and we want
+ to test theses includes files. */
f = fopen ("inp_str.data", "r");
- i = mpf_inp_str (x, f, 10);
- if ((i == 0) || mpf_cmp_ui (x, 31415))
+ if (f != NULL)
{
- printf ("Error in reading 1st line from file inp_str.data\n");
- exit (1);
+ i = mpf_inp_str (x, f, 10);
+ if ((i == 0) || mpf_cmp_ui (x, 31415))
+ {
+ printf ("Error in reading 1st line from file inp_str.data\n");
+ exit (1);
+ }
+ fclose (f);
}
- fclose (f);
/* Miscellaneous Functions */
diff --git a/tests/tacos.c b/tests/tacos.c
index e1df1cb9b..cf045fc2e 100644
--- a/tests/tacos.c
+++ b/tests/tacos.c
@@ -75,8 +75,8 @@ special_overflow (void)
{
mpfr_t x, y;
- mpfr_set_emin (-125);
- mpfr_set_emax (128);
+ set_emin (-125);
+ set_emax (128);
mpfr_init2 (x, 24);
mpfr_init2 (y, 48);
mpfr_set_str_binary (x, "0.101100100000000000110100E0");
@@ -90,8 +90,8 @@ special_overflow (void)
}
mpfr_clear (y);
mpfr_clear (x);
- mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_emax (MPFR_EMAX_MAX);
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
}
int
diff --git a/tests/tadd1sp.c b/tests/tadd1sp.c
index 804e700d3..04d769d52 100644
--- a/tests/tadd1sp.c
+++ b/tests/tadd1sp.c
@@ -32,11 +32,11 @@ check_overflow (void)
{
mpfr_t x, y, z1, z2;
- mpfr_set_emin (-1021);
- mpfr_set_emax (1024);
+ set_emin (-1021);
+ set_emax (1024);
mpfr_inits (x, y, z1, z2, NULL);
-
+
mpfr_set_str1 (x, "8.00468257869324898448e+307");
mpfr_set_str1 (y, "7.44784712422708645156e+307");
mpfr_add1sp (z1, x, y, GMP_RNDN);
@@ -67,7 +67,7 @@ int main(void)
#define STD_ERROR \
{\
printf("ERROR: for %s and p=%lu and i=%d:\nB=",\
- mpfr_print_rnd_mode(r), p, i);\
+ mpfr_print_rnd_mode(r), p, i);\
mpfr_print_binary(b);\
printf("\nC="); mpfr_print_binary(c);\
printf("\nadd1 : "); mpfr_print_binary(a1);\
@@ -79,20 +79,21 @@ int main(void)
#define STD_ERROR2 \
{\
printf("ERROR: Wrong inexact flag for %s and p=%lu and i=%d:\nB=",\
- mpfr_print_rnd_mode(r), p, i);\
+ mpfr_print_rnd_mode(r), p, i);\
mpfr_print_binary(b);\
printf("\nC="); mpfr_print_binary(c);\
printf("\nA="); mpfr_print_binary(a1);\
printf("\nAdd1: %d. Add1sp: %d\n", \
- inexact1, inexact2); \
+ inexact1, inexact2); \
exit(1);\
}
#define SET_PREC(_p) \
- { p = _p; \
- mpfr_set_prec(a1, _p); mpfr_set_prec(a2, _p); \
- mpfr_set_prec(b, _p); mpfr_set_prec(c, _p); \
- }
+ { \
+ p = _p; \
+ mpfr_set_prec(a1, _p); mpfr_set_prec(a2, _p); \
+ mpfr_set_prec(b, _p); mpfr_set_prec(c, _p); \
+ }
void check_random(mp_prec_t p)
@@ -103,25 +104,25 @@ void check_random(mp_prec_t p)
mpfr_inits2(p, a1,b,c,a2, NULL);
- for(i = 0 ; i < 500 ; i++)
+ for (i = 0 ; i < 500 ; i++)
{
mpfr_random(b);
mpfr_random(c);
if (MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c))
- {
- if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c))
- mpfr_swap(b, c);
- if (MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c))
- for(r = 0 ; r < GMP_RND_MAX ; r++)
- {
- inexact1 = mpfr_add1(a1, b, c, r);
- inexact2 = mpfr_add1sp(a2, b, c, r);
- if (mpfr_cmp(a1, a2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
- }
- }
+ {
+ if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c))
+ mpfr_swap(b, c);
+ if (MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c))
+ for (r = 0 ; r < GMP_RND_MAX ; r++)
+ {
+ inexact1 = mpfr_add1(a1, b, c, r);
+ inexact2 = mpfr_add1sp(a2, b, c, r);
+ if (mpfr_cmp(a1, a2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+ }
+ }
}
mpfr_clears(a1,a2,b,c,NULL);
@@ -136,7 +137,7 @@ void check_special(void)
mpfr_inits(a1,a2,b,c,NULL);
- for(r = 0 ; r < GMP_RND_MAX ; r++)
+ for (r = 0 ; r < GMP_RND_MAX ; r++)
{
SET_PREC(53);
mpfr_set_str1 (b, "1@100");
@@ -144,9 +145,9 @@ void check_special(void)
inexact1 = mpfr_add1(a1, b, c, r);
inexact2 = mpfr_add1sp(a2, b, c, r);
if (mpfr_cmp(a1, a2))
- STD_ERROR;
+ STD_ERROR;
if (inexact1 != inexact2)
- STD_ERROR2;
+ STD_ERROR2;
mpfr_set_str_binary (b, "1E53");
mpfr_set_str_binary (c, "1E0");
inexact1 = mpfr_add1(a1, b, c, r);
@@ -157,5 +158,5 @@ void check_special(void)
STD_ERROR2;
}
- mpfr_clears(a1,a2,b,c,NULL);
+ mpfr_clears(a1,a2,b,c,NULL);
}
diff --git a/tests/tasin.c b/tests/tasin.c
index 12bdaf579..f09ed4235 100644
--- a/tests/tasin.c
+++ b/tests/tasin.c
@@ -157,8 +157,8 @@ special_overflow (void)
{
mpfr_t x, y;
- mpfr_set_emin (-125);
- mpfr_set_emax (128);
+ set_emin (-125);
+ set_emax (128);
mpfr_init2 (x, 24);
mpfr_init2 (y, 48);
mpfr_set_str_binary (x, "0.101100100000000000110100E0");
@@ -172,8 +172,8 @@ special_overflow (void)
}
mpfr_clear (y);
mpfr_clear (x);
- mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_emax (MPFR_EMAX_MAX);
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
}
int
diff --git a/tests/tatan.c b/tests/tatan.c
index f0f146ad7..f3ef4f0e3 100644
--- a/tests/tatan.c
+++ b/tests/tatan.c
@@ -157,8 +157,8 @@ special_overflow (void)
{
mpfr_t x, y;
- mpfr_set_emin (-125);
- mpfr_set_emax (128);
+ set_emin (-125);
+ set_emax (128);
mpfr_init2 (x, 24);
mpfr_init2 (y, 48);
mpfr_set_str_binary (x, "0.101101010001001101111010E0");
@@ -172,8 +172,8 @@ special_overflow (void)
}
mpfr_clear (y);
mpfr_clear (x);
- mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_emax (MPFR_EMAX_MAX);
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
}
int
diff --git a/tests/tcos.c b/tests/tcos.c
index 5c02f6709..1500508ee 100644
--- a/tests/tcos.c
+++ b/tests/tcos.c
@@ -121,12 +121,12 @@ special_overflow (void)
mpfr_init2 (y, 73);
/* Check special case: An overflow in const_pi could occurs! */
- mpfr_set_emin (-125);
- mpfr_set_emax (128);
+ set_emin (-125);
+ set_emax (128);
mpfr_set_str_binary (x, "0.111101010110110011101101E6");
mpfr_cos (y, x, GMP_RNDZ);
- mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_emax (MPFR_EMAX_MAX);
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
mpfr_clear (x);
mpfr_clear (y);
diff --git a/tests/tcosh.c b/tests/tcosh.c
index d48a4ed68..74b138a7b 100644
--- a/tests/tcosh.c
+++ b/tests/tcosh.c
@@ -110,8 +110,8 @@ special_overflow (void)
3. cosh(x) exp overflow even with the largest range of exp */
mpfr_t x, y;
- mpfr_set_emin (-125);
- mpfr_set_emax (128);
+ set_emin (-125);
+ set_emax (128);
mpfr_init2 (x, 24);
mpfr_init2 (y, 24);
@@ -134,8 +134,8 @@ special_overflow (void)
exit (1);
}
- mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_emax (MPFR_EMAX_MAX);
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
mpfr_set_str_binary (x, "0.101100100000000000110100E1000000");
mpfr_cosh (y, x, GMP_RNDN);
diff --git a/tests/tdiv.c b/tests/tdiv.c
index 4e9457b56..fafa70e9d 100644
--- a/tests/tdiv.c
+++ b/tests/tdiv.c
@@ -544,17 +544,17 @@ check_nan (void)
/* check overflow */
emax = mpfr_get_emax ();
- mpfr_set_emax (1);
+ set_emax (1);
mpfr_set_ui (a, 1, GMP_RNDZ);
mpfr_set_ui (d, 1, GMP_RNDZ);
mpfr_div_2exp (d, d, 1, GMP_RNDZ);
mpfr_div (q, a, d, GMP_RNDU); /* 1 / 0.5 = 2 -> overflow */
MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0);
- mpfr_set_emax (emax);
+ set_emax (emax);
/* check underflow */
emin = mpfr_get_emin ();
- mpfr_set_emin (-1);
+ set_emin (-1);
mpfr_set_ui (a, 1, GMP_RNDZ);
mpfr_div_2exp (a, a, 2, GMP_RNDZ);
mpfr_set_ui (d, 2, GMP_RNDZ);
@@ -562,7 +562,7 @@ check_nan (void)
MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_POS (q));
mpfr_div (q, a, d, GMP_RNDN); /* 0.5*2^(-2) -> underflow */
MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_POS (q));
- mpfr_set_emin (emin);
+ set_emin (emin);
mpfr_clear (a);
mpfr_clear (d);
diff --git a/tests/tests.c b/tests/tests.c
index 495410f18..d1e86bcb9 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -27,6 +27,7 @@ MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <float.h>
#if TIME_WITH_SYS_TIME
@@ -61,7 +62,7 @@ tests_end_mpfr (void)
tests_memory_end ();
}
-void
+static void
tests_rand_start (void)
{
gmp_randstate_ptr rands;
@@ -105,7 +106,7 @@ tests_rand_start (void)
}
}
-void
+static void
tests_rand_end (void)
{
RANDS_CLEAR ();
@@ -116,7 +117,7 @@ void
mpfr_test_init ()
{
double c, d, eps;
-#ifdef __mips
+#if HAVE_FPC_CSR
/* to get denormalized numbers on IRIX64 */
union fpc_csr exp;
@@ -287,3 +288,42 @@ ld_trace (const char *name, long double ld)
}
printf ("] %.20Lg\n", ld);
}
+
+/* Open a file in the src directory - can't use fopen directly */
+FILE *src_fopen (const char *filename, const char *mode)
+{
+ const char *srcdir = getenv ("srcdir");
+ char *buffer;
+ FILE *f;
+
+ if (srcdir == NULL)
+ return fopen (filename, mode);
+ buffer = malloc (strlen (filename) + strlen (srcdir) + 1);
+ if (buffer == NULL)
+ {
+ printf ("src_fopen: failed to alloc memory)\n");
+ exit (1);
+ }
+ sprintf (buffer, "%s/%s", srcdir, filename);
+ f = fopen (buffer, mode);
+ free (buffer);
+ return f;
+}
+
+void set_emin (mp_exp_t exponent)
+{
+ if (mpfr_set_emin (exponent))
+ {
+ printf ("set_emin: setting emin to %ld failed\n", (long int) exponent);
+ exit (1);
+ }
+}
+
+void set_emax (mp_exp_t exponent)
+{
+ if (mpfr_set_emax (exponent))
+ {
+ printf ("set_emax: setting emax to %ld failed\n", (long int) exponent);
+ exit (1);
+ }
+}
diff --git a/tests/texceptions.c b/tests/texceptions.c
index 0d99daaec..1ff15158f 100644
--- a/tests/texceptions.c
+++ b/tests/texceptions.c
@@ -82,8 +82,8 @@ mpfr_set_double_range (void)
(We have to add one for mpfr since mantissa are between 1/2 and 1.)
*/
- mpfr_set_emin (-1021);
- mpfr_set_emax (1024);
+ set_emin (-1021);
+ set_emax (1024);
}
static void
@@ -249,7 +249,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_emax (1025);
+ set_emax (1025);
mpfr_set_ui (x, 1, GMP_RNDN);
mpfr_mul_2exp (x, x, 1024, GMP_RNDN);
mpfr_set_double_range ();
@@ -293,7 +293,7 @@ main (int argc, char *argv[])
exit (1);
}
- mpfr_set_emin (-1026);
+ set_emin (-1026);
mpfr_set_ui (x, 1, GMP_RNDN);
mpfr_div_2exp (x, x, 1025, GMP_RNDN);
mpfr_set_double_range ();
diff --git a/tests/texp.c b/tests/texp.c
index d1bba9a51..153b200c5 100644
--- a/tests/texp.c
+++ b/tests/texp.c
@@ -217,7 +217,7 @@ check_special ()
/* check overflow */
emax = mpfr_get_emax ();
- mpfr_set_emax (10);
+ set_emax (10);
mpfr_set_ui (x, 7, GMP_RNDN);
mpfr_exp (y, x, GMP_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
@@ -225,11 +225,11 @@ check_special ()
printf ("Error for exp(7) for emax=10\n");
exit (1);
}
- mpfr_set_emax (emax);
+ set_emax (emax);
/* check underflow */
emin = mpfr_get_emin ();
- mpfr_set_emin (-10);
+ set_emin (-10);
mpfr_set_si (x, -9, GMP_RNDN);
mpfr_exp (y, x, GMP_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
@@ -239,7 +239,7 @@ check_special ()
printf ("Got "); mpfr_print_binary (y); puts ("");
exit (1);
}
- mpfr_set_emin (emin);
+ set_emin (emin);
/* check case EXP(x) < -precy */
mpfr_set_prec (y, 2);
@@ -295,8 +295,8 @@ check_special ()
mpfr_exp_3 (y, x, GMP_RNDN);
/* Check some little things about overflow detection */
- mpfr_set_emin (-125);
- mpfr_set_emax (128);
+ set_emin (-125);
+ set_emax (128);
mpfr_set_prec (x, 107);
mpfr_set_prec (y, 107);
mpfr_set_str_binary (x, "0.11110000000000000000000000000000000000000000000"
@@ -312,8 +312,8 @@ check_special ()
exit (1);
}
- mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_emax (MPFR_EMAX_MAX);
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
/* Check for overflow producing a segfault with HUGE exponent */
mpfr_set_ui (x, 3, GMP_RNDN);
diff --git a/tests/texp2.c b/tests/texp2.c
index e304f85d6..771346efe 100644
--- a/tests/texp2.c
+++ b/tests/texp2.c
@@ -33,8 +33,8 @@ special_overflow (void)
{
mpfr_t x, y;
- mpfr_set_emin (-125);
- mpfr_set_emax (128);
+ set_emin (-125);
+ set_emax (128);
mpfr_init2 (x, 24);
mpfr_init2 (y, 24);
@@ -50,8 +50,8 @@ special_overflow (void)
mpfr_clear (y);
mpfr_clear (x);
- mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_emax (MPFR_EMAX_MAX);
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
}
int
@@ -102,7 +102,7 @@ main (int argc, char *argv[])
mpfr_set_prec (y, 10);
/* save emin */
emin = mpfr_get_emin ();
- mpfr_set_emin (-10);
+ set_emin (-10);
mpfr_set_si (x, -12, GMP_RNDN);
mpfr_exp2 (y, x, GMP_RNDN);
if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0)
@@ -113,11 +113,11 @@ main (int argc, char *argv[])
exit (1);
}
/* restore emin */
- mpfr_set_emin (emin);
+ set_emin (emin);
/* save emax */
emax = mpfr_get_emax ();
- mpfr_set_emax (10);
+ set_emax (10);
mpfr_set_ui (x, 11, GMP_RNDN);
mpfr_exp2 (y, x, GMP_RNDN);
if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
@@ -126,7 +126,7 @@ main (int argc, char *argv[])
exit (1);
}
/* restore emax */
- mpfr_set_emax (emax);
+ set_emax (emax);
MPFR_SET_INF(x);
diff --git a/tests/tgamma.c b/tests/tgamma.c
index 5894bfd06..1d0af89de 100644
--- a/tests/tgamma.c
+++ b/tests/tgamma.c
@@ -171,8 +171,8 @@ special_overflow (void)
{
mpfr_t x, y;
- mpfr_set_emin (-125);
- mpfr_set_emax (128);
+ set_emin (-125);
+ set_emax (128);
mpfr_init2 (x, 24);
mpfr_init2 (y, 24);
@@ -187,8 +187,8 @@ special_overflow (void)
mpfr_clear (y);
mpfr_clear (x);
- mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_emax (MPFR_EMAX_MAX);
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
}
int
diff --git a/tests/tinp_str.c b/tests/tinp_str.c
index 534fd61da..4370be102 100644
--- a/tests/tinp_str.c
+++ b/tests/tinp_str.c
@@ -30,13 +30,12 @@ main (int argc, char *argv[])
mpfr_t x;
FILE *f;
int i;
-
tests_start_mpfr ();
mpfr_init (x);
mpfr_set_prec (x, 15);
- f = fopen ("inp_str.data", "r");
+ f = src_fopen ("inp_str.data", "r");
if (f == NULL)
{
printf ("Error, can't open inp_str.data\n");
diff --git a/tests/tlog.c b/tests/tlog.c
index 1ad90cf5f..8d839ee00 100644
--- a/tests/tlog.c
+++ b/tests/tlog.c
@@ -159,14 +159,14 @@ special (void)
mpfr_init2 (y, 53);
/* Check special case: An overflow in const_pi could occurs! */
- mpfr_set_emin (-125);
- mpfr_set_emax (128);
+ set_emin (-125);
+ set_emax (128);
mpfr_set_prec (y, 24*2);
mpfr_set_prec (x, 24);
mpfr_set_str_binary (x, "0.111110101010101011110101E0");
mpfr_log (y, x, GMP_RNDN);
- mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_emax (MPFR_EMAX_MAX);
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
mpfr_set_prec (y, 53);
mpfr_set_prec (x, 53);
diff --git a/tests/tmul.c b/tests/tmul.c
index e825effda..51580b864 100644
--- a/tests/tmul.c
+++ b/tests/tmul.c
@@ -300,17 +300,17 @@ check_max(void)
/* check underflow */
emin = mpfr_get_emin ();
- mpfr_set_emin (0);
+ set_emin (0);
mpfr_set_str_binary (xx, "0.1E0");
mpfr_set_str_binary (yy, "0.1E0");
mpfr_mul (zz, xx, yy, GMP_RNDN);
/* exact result is 0.1E-1, which should round to 0 */
MPFR_ASSERTN(mpfr_cmp_ui (zz, 0) == 0 && MPFR_IS_POS(zz));
- mpfr_set_emin (emin);
+ set_emin (emin);
/* coverage test for mpfr_powerof2_raw */
emin = mpfr_get_emin ();
- mpfr_set_emin (0);
+ set_emin (0);
mpfr_set_prec (xx, mp_bits_per_limb + 1);
mpfr_set_str_binary (xx, "0.1E0");
mpfr_nextabove (xx);
@@ -318,7 +318,7 @@ check_max(void)
mpfr_mul (zz, xx, yy, GMP_RNDN);
/* exact result is just above 0.1E-1, which should round to minfloat */
MPFR_ASSERTN(mpfr_cmp (zz, yy) == 0);
- mpfr_set_emin (emin);
+ set_emin (emin);
mpfr_clear(xx);
mpfr_clear(yy);
diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c
index 09bfb3490..327e19f3c 100644
--- a/tests/tmul_ui.c
+++ b/tests/tmul_ui.c
@@ -140,11 +140,11 @@ main (int argc, char *argv[])
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
emax = mpfr_get_emax ();
- mpfr_set_emax (0);
+ set_emax (0);
mpfr_set_str_binary (x, "0.1E0");
mpfr_mul_ui (x, x, 2, GMP_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x));
- mpfr_set_emax (emax);
+ set_emax (emax);
mpfr_set_str (x, /*1.0/3.0*/
"0.333333333333333333333333333333333", 10, GMP_RNDZ);
diff --git a/tests/tout_str.c b/tests/tout_str.c
index c9997ce9b..bfa168a85 100644
--- a/tests/tout_str.c
+++ b/tests/tout_str.c
@@ -135,7 +135,12 @@ main (int argc, char *argv[])
/* with no argument: prints to /dev/null,
tout_str N: prints N tests to stdout */
if (argc == 1)
- fout = fopen ("/dev/null", "w");
+ {
+ fout = fopen ("/dev/null", "w");
+ /* If we failed to open this device, try with a dummy file */
+ if (fout == NULL)
+ fout = fopen ("mpfrtest.txt", "w");
+ }
else
{
fout = stdout;
diff --git a/tests/trandom.c b/tests/trandom.c
index e5d1ff967..f59bbae4b 100644
--- a/tests/trandom.c
+++ b/tests/trandom.c
@@ -188,7 +188,7 @@ test_urandomb (long nbtests, mp_prec_t prec, int verbose)
/* coverage test */
emin = mpfr_get_emin ();
- mpfr_set_emin (1); /* the generated number in [0,1[ is not in the exponent
+ set_emin (1); /* the generated number in [0,1[ is not in the exponent
range, except if it is zero */
k = mpfr_urandomb (x, state);
if (MPFR_IS_ZERO(x) == 0 && (k == 0 || mpfr_nan_p (x) == 0))
@@ -197,7 +197,7 @@ test_urandomb (long nbtests, mp_prec_t prec, int verbose)
mpfr_dump (x);
exit (1);
}
- mpfr_set_emin (emin);
+ set_emin (emin);
mpfr_clear (x);
gmp_randclear (state);
diff --git a/tests/trint.c b/tests/trint.c
index e2b66939d..3a93bc66e 100644
--- a/tests/trint.c
+++ b/tests/trint.c
@@ -64,13 +64,13 @@ special (void)
/* another coverage test */
emax = mpfr_get_emax ();
- mpfr_set_emax (1);
+ set_emax (1);
mpfr_set_prec (x, 3);
mpfr_set_str_binary (x, "1.11E0");
mpfr_set_prec (y, 2);
mpfr_rint (y, x, GMP_RNDU); /* x rounds to 1.0E1=0.1E2 which overflows */
MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0);
- mpfr_set_emax (emax);
+ set_emax (emax);
/* yet another */
mpfr_set_prec (x, 97);
diff --git a/tests/tround_prec.c b/tests/tround_prec.c
index b7e07c0fa..8073e59b0 100644
--- a/tests/tround_prec.c
+++ b/tests/tround_prec.c
@@ -56,12 +56,12 @@ main (void)
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG(x));
emax = mpfr_get_emax ();
- mpfr_set_emax (0);
+ set_emax (0);
mpfr_set_prec (x, 3);
mpfr_set_str_binary (x, "0.111");
mpfr_prec_round (x, 2, GMP_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
- mpfr_set_emax (emax);
+ set_emax (emax);
mpfr_set_prec (x, mp_bits_per_limb + 2);
mpfr_set_ui (x, 1, GMP_RNDN);
diff --git a/tests/tset.c b/tests/tset.c
index 04411a3d1..4f67b035e 100644
--- a/tests/tset.c
+++ b/tests/tset.c
@@ -80,13 +80,13 @@ main (void)
MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG(y));
emax = mpfr_get_emax ();
- mpfr_set_emax (0);
+ set_emax (0);
mpfr_set_prec (x, 3);
mpfr_set_str_binary (x, "0.111");
mpfr_set_prec (y, 2);
mpfr_set (y, x, GMP_RNDU);
MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0);
- mpfr_set_emax (emax);
+ set_emax (emax);
mpfr_set_prec (y, 11);
mpfr_set_str_binary (y, "0.11111111100E-8");
diff --git a/tests/tset_exp.c b/tests/tset_exp.c
index 27381345a..9e29206f2 100644
--- a/tests/tset_exp.c
+++ b/tests/tset_exp.c
@@ -38,11 +38,11 @@ main (int argc, char *argv[])
ret = mpfr_set_exp (x, 2);
MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui (x, 2) == 0);
- mpfr_set_emin (-1);
+ set_emin (-1);
ret = mpfr_set_exp (x, -1);
MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui_2exp (x, 1, -2) == 0);
- mpfr_set_emax (1);
+ set_emax (1);
ret = mpfr_set_exp (x, 1);
MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui (x, 1) == 0);
diff --git a/tests/tset_ld.c b/tests/tset_ld.c
index dbf806b0b..3fd7397f3 100644
--- a/tests/tset_ld.c
+++ b/tests/tset_ld.c
@@ -172,14 +172,14 @@ main (int argc, char *argv[])
/* check with reduced emax to exercise overflow */
emax = mpfr_get_emax ();
mpfr_set_prec (x, 2);
- mpfr_set_emax (1);
+ set_emax (1);
mpfr_set_ld (x, (long double) 2.0, GMP_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
for (d = (long double) 2.0, i = 0; i < 13; i++, d *= d);
/* now d = 2^8192 */
mpfr_set_ld (x, d, GMP_RNDN);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
- mpfr_set_emax (emax);
+ set_emax (emax);
mpfr_clear (x);
diff --git a/tests/tset_si.c b/tests/tset_si.c
index 9f4771283..777f222ea 100644
--- a/tests/tset_si.c
+++ b/tests/tset_si.c
@@ -190,17 +190,17 @@ main (int argc, char *argv[])
/* check potential bug in case mp_limb_t is unsigned */
emax = mpfr_get_emax ();
- mpfr_set_emax (0);
+ set_emax (0);
mpfr_set_si (x, -1, GMP_RNDN);
if (mpfr_sgn (x) >= 0)
{
printf ("mpfr_set_si (x, -1) fails\n");
exit (1);
}
- mpfr_set_emax (emax);
+ set_emax (emax);
emax = mpfr_get_emax ();
- mpfr_set_emax (5);
+ set_emax (5);
mpfr_set_prec (x, 2);
mpfr_set_si (x, -31, GMP_RNDN);
if (mpfr_sgn (x) >= 0)
@@ -208,7 +208,7 @@ main (int argc, char *argv[])
printf ("mpfr_set_si (x, -31) fails\n");
exit (1);
}
- mpfr_set_emax (emax);
+ set_emax (emax);
/* test for get_ui */
mpfr_set_ui (x, 0, GMP_RNDN);
@@ -244,13 +244,13 @@ main (int argc, char *argv[])
mpfr_set_ui (x, 7, GMP_RNDU);
MPFR_ASSERTN(mpfr_cmp_ui (x, 8) == 0);
emax = mpfr_get_emax ();
- mpfr_set_emax (3);
+ set_emax (3);
mpfr_set_ui (x, 7, GMP_RNDU);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
- mpfr_set_emax (1);
+ set_emax (1);
MPFR_ASSERTN( mpfr_set_ui (x, 7, GMP_RNDU) );
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
- mpfr_set_emax (emax);
+ set_emax (emax);
/* Test for ERANGE flag + correct behaviour if overflow */
mpfr_set_prec (x, 256);
diff --git a/tests/tset_str.c b/tests/tset_str.c
index 8ac2b6961..be520eb07 100644
--- a/tests/tset_str.c
+++ b/tests/tset_str.c
@@ -55,9 +55,9 @@ check_underflow (void)
/* Check underflow */
emin = mpfr_get_emin ();
- mpfr_set_emin (-20);
+ set_emin (-20);
res = mpfr_set_str (a, "0.00000000001", 10, GMP_RNDZ);
- if (!MPFR_IS_ZERO (a) || res == 0)
+ if (!MPFR_IS_ZERO (a))
{
printf("ERROR for mpfr_set_str (a, \"0.00000000001\", 10, GMP_RNDN)\n"
" with emin=-20\n"
@@ -65,18 +65,18 @@ check_underflow (void)
mpfr_dump (a);
exit (1);
}
- mpfr_set_emin (emin);
+ set_emin (emin);
/* check overflow */
emax = mpfr_get_emax ();
- mpfr_set_emax (1073741823); /* 2^30-1 */
+ set_emax (1073741823); /* 2^30-1 */
mpfr_set_str (a, "2E1000000000", 10, GMP_RNDN);
if (!mpfr_inf_p (a) || mpfr_sgn (a) < 0)
{
printf("ERROR for mpfr_set_str (a, \"2E1000000000\", 10, GMP_RNDN);\n");
exit (1);
}
- mpfr_set_emax (emax);
+ set_emax (emax);
mpfr_clear (a);
}
@@ -114,7 +114,6 @@ main (int argc, char *argv[])
str2 = str = (*__gmp_allocate_func) (nc * sizeof(char));
if (bd)
-
{
for(k = 1; k <= bd; k++)
*(str2++) = (randlimb () & 1) + '0';
@@ -235,13 +234,14 @@ main (int argc, char *argv[])
for (i = 2; i <= 36; i++)
{
- if (mpfr_set_str (x, "@NaN@garbage", i, GMP_RNDN) != 0 ||
+ if (mpfr_set_str (x, "@NaN@(garbage)", i, GMP_RNDN) != 0 ||
!mpfr_nan_p(x))
{
- printf ("mpfr_set_str failed on @NaN@garbage\n");
+ printf ("mpfr_set_str failed on @NaN@(garbage)\n");
exit (1);
}
+ /*
if (mpfr_set_str (x, "@Inf@garbage", i, GMP_RNDN) != 0 ||
!mpfr_inf_p(x) || MPFR_SIGN(x) < 0)
{
@@ -262,6 +262,7 @@ main (int argc, char *argv[])
printf ("mpfr_set_str failed on +@Inf@garbage\n");
exit (1);
}
+ */
if (i > 16)
continue;
@@ -806,26 +807,26 @@ main (int argc, char *argv[])
/* check invalid input */
mpfr_set_ui (x, 1, GMP_RNDN);
ret = mpfr_set_str (x, "1", 37, GMP_RNDN);
- MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0 && ret == -1);
+ MPFR_ASSERTN (ret == -1);
ret = mpfr_set_str (x, "1E10toto", 10, GMP_RNDN);
- MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0 && ret == -1);
+ MPFR_ASSERTN (ret == -1);
ret = mpfr_set_str (x, "1p10toto", 16, GMP_RNDN);
- MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0 && ret == -1);
+ MPFR_ASSERTN (ret == -1);
ret = mpfr_set_str (x, "", 16, GMP_RNDN);
- MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0 && ret == -1);
+ MPFR_ASSERTN (ret == -1);
ret = mpfr_set_str (x, "+", 16, GMP_RNDN);
- MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0 && ret == -1);
+ MPFR_ASSERTN (ret == -1);
ret = mpfr_set_str (x, "-", 16, GMP_RNDN);
- MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0 && ret == -1);
+ MPFR_ASSERTN (ret == -1);
ret = mpfr_set_str (x, "this_is_an_invalid_number_in_base_36", 36, GMP_RNDN);
- MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0 && ret == -1);
+ MPFR_ASSERTN (ret == -1);
ret = mpfr_set_str (x, "1.2.3", 10, GMP_RNDN);
- MPFR_ASSERTN(mpfr_cmp_ui (x, 1) == 0 && ret == -1);
+ MPFR_ASSERTN (ret == -1);
mpfr_set_prec (x, 135);
ret = mpfr_set_str (x, "thisisavalidnumberinbase36", 36, GMP_RNDN);
mpfr_set_prec (y, 135);
mpfr_set_str (y, "23833565676460972739462619524519814462546", 10, GMP_RNDN);
- MPFR_ASSERTN(mpfr_cmp (x, y) == 0 && ret == 0);
+ MPFR_ASSERTN (mpfr_cmp (x, y) == 0 && ret == 0);
/* coverage test for set_str_binary */
mpfr_set_str_binary (x, "NaN");
diff --git a/tests/tset_z.c b/tests/tset_z.c
index f0f49f5fc..f733b4f40 100644
--- a/tests/tset_z.c
+++ b/tests/tset_z.c
@@ -94,27 +94,27 @@ check_large (void)
/* check overflow */
emax = mpfr_get_emax ();
- mpfr_set_emax (2);
+ set_emax (2);
mpz_set_str (z, "7", 10);
mpfr_set_z (x, z, GMP_RNDU);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
- mpfr_set_emax (3);
+ set_emax (3);
mpfr_set_prec (x, 2);
mpz_set_str (z, "7", 10);
mpfr_set_z (x, z, GMP_RNDU);
MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0);
- mpfr_set_emax (emax);
+ set_emax (emax);
/* check underflow */
emin = mpfr_get_emin ();
- mpfr_set_emin (3);
+ set_emin (3);
mpz_set_str (z, "1", 10);
mpfr_set_z (x, z, GMP_RNDZ);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
- mpfr_set_emin (2);
+ set_emin (2);
mpfr_set_z (x, z, GMP_RNDN);
MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x));
- mpfr_set_emin (emin);
+ set_emin (emin);
mpz_clear (z);
mpfr_clear (x);
diff --git a/tests/tstrtofr.c b/tests/tstrtofr.c
index 29cad883b..f88542ed6 100644
--- a/tests/tstrtofr.c
+++ b/tests/tstrtofr.c
@@ -142,6 +142,7 @@ check_special (void)
}
/* Check base 62 */
+#if 0
res = mpfr_strtofr (x, "A", NULL, 62, GMP_RNDN);
if (res != 0 || mpfr_cmp_ui (x, 10))
{
@@ -174,6 +175,7 @@ check_special (void)
putchar ('\n');
exit (1);
}
+#endif
mpfr_clear (x);
mpfr_clear (y);
diff --git a/tests/tsub1sp.c b/tests/tsub1sp.c
index 3983a9f6a..1dcc476be 100644
--- a/tests/tsub1sp.c
+++ b/tests/tsub1sp.c
@@ -34,7 +34,7 @@ int main(void)
tests_start_mpfr ();
check_special ();
- for(p = 2 ; p < 200 ; p++)
+ for (p = 2 ; p < 200 ; p++)
check_random (p);
tests_end_mpfr ();
@@ -44,12 +44,12 @@ int main(void)
#define STD_ERROR \
{\
printf("ERROR: for %s and p=%lu and i=%d:\nY=",\
- mpfr_print_rnd_mode(r), p, i);\
- mpfr_print_binary(y);\
- printf("\nZ="); mpfr_print_binary(z);\
- printf("\nReal: "); mpfr_print_binary(x2);\
- printf("\nGot : "); mpfr_print_binary(x);\
- putchar('\n');\
+ mpfr_print_rnd_mode(r), p, i);\
+ mpfr_print_binary(y);\
+ printf("\nZ="); mpfr_print_binary(z);\
+ printf("\nReal: "); mpfr_print_binary(x2);\
+ printf("\nGot : "); mpfr_print_binary(x);\
+ putchar('\n');\
exit(1);\
}
@@ -61,7 +61,7 @@ int main(void)
printf("\nZ="); mpfr_print_binary(z);\
printf("\nR="); mpfr_print_binary(x);\
printf("\nWrong inexact flag. Real: %d. Got: %d\n", \
- inexact1, inexact2); \
+ inexact1, inexact2); \
exit(1);\
}
@@ -73,20 +73,20 @@ void check_random(mpfr_prec_t p)
mpfr_inits2(p, x,y,z,x2,NULL);
- for(i = 0 ; i < 500 ; i++)
+ for (i = 0 ; i < 500 ; i++)
{
mpfr_random (y);
mpfr_random (z);
if (MPFR_IS_PURE_FP(y) && MPFR_IS_PURE_FP(z))
- for(r = 0 ; r < GMP_RND_MAX ; r++)
- {
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
- }
+ for(r = 0 ; r < GMP_RND_MAX ; r++)
+ {
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+ }
}
mpfr_clears(x,y,z,x2,NULL);
@@ -102,7 +102,7 @@ void check_special(void)
mpfr_inits(x,y,z,x2,NULL);
- for(r = 0 ; r < GMP_RND_MAX ; r++)
+ for (r = 0 ; r < GMP_RND_MAX ; r++)
{
p = 53;
mpfr_set_prec(x, 53);
@@ -110,75 +110,75 @@ void check_special(void)
mpfr_set_prec(y, 53);
mpfr_set_prec(z, 53);
- mpfr_set_str_binary (y,
+ mpfr_set_str_binary (y,
"0.10110111101101110010010010011011000001101101011011001E31");
-
+
mpfr_sub1sp(x, y, y, r);
if (mpfr_cmp_ui(x, 0))
- {
- printf("Error for x-x with p=%lu. Expected 0. Got:", p);
- mpfr_print_binary(x);
- exit(1);
- }
-
+ {
+ printf("Error for x-x with p=%lu. Expected 0. Got:", p);
+ mpfr_print_binary(x);
+ exit(1);
+ }
+
mpfr_set(z, y, r);
mpfr_sub1sp(x, y, z, r);
if (mpfr_cmp_ui(x, 0))
- {
- printf("Error for x-y with y=x and p=%lu. Expected 0. Got:", p);
- mpfr_print_binary(x);
- exit(1);
- }
+ {
+ printf("Error for x-y with y=x and p=%lu. Expected 0. Got:", p);
+ mpfr_print_binary(x);
+ exit(1);
+ }
/* diff = 0 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011001001101101011011001E31");
inexact1 = mpfr_sub1(x2, y, z, r);
inexact2 = mpfr_sub1sp(x, y, z, r);
if (mpfr_cmp(x, x2))
- STD_ERROR;
+ STD_ERROR;
if (inexact1 != inexact2)
- STD_ERROR2;
-
+ STD_ERROR2;
+
/* Diff = 1 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011000001101101011011001E30");
inexact1 = mpfr_sub1(x2, y, z, r);
inexact2 = mpfr_sub1sp(x, y, z, r);
if (mpfr_cmp(x, x2))
- STD_ERROR;
+ STD_ERROR;
if (inexact1 != inexact2)
- STD_ERROR2;
-
+ STD_ERROR2;
+
/* Diff = 2 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011000101101101011011001E32");
inexact1 = mpfr_sub1(x2, y, z, r);
inexact2 = mpfr_sub1sp(x, y, z, r);
if (mpfr_cmp(x, x2))
- STD_ERROR;
+ STD_ERROR;
if (inexact1 != inexact2)
- STD_ERROR2;
-
+ STD_ERROR2;
+
/* Diff = 32 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011000001101101011011001E63");
inexact1 = mpfr_sub1(x2, y, z, r);
inexact2 = mpfr_sub1sp(x, y, z, r);
if (mpfr_cmp(x, x2))
- STD_ERROR;
+ STD_ERROR;
if (inexact1 != inexact2)
- STD_ERROR2;
-
+ STD_ERROR2;
+
/* Diff = 52 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011010001101101011011001E83");
inexact1 = mpfr_sub1(x2, y, z, r);
inexact2 = mpfr_sub1sp(x, y, z, r);
if (mpfr_cmp(x, x2))
- STD_ERROR;
+ STD_ERROR;
if (inexact1 != inexact2)
- STD_ERROR2;
-
+ STD_ERROR2;
+
/* Diff = 53 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011111000001101101011011001E31");
@@ -187,7 +187,7 @@ void check_special(void)
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
- STD_ERROR2;
+ STD_ERROR2;
/* Diff > 200 */
mpfr_set_str_binary (y,
@@ -195,312 +195,311 @@ void check_special(void)
inexact1 = mpfr_sub1(x2, y, z, r);
inexact2 = mpfr_sub1sp(x, y, z, r);
if (mpfr_cmp(x, x2))
- STD_ERROR;
+ STD_ERROR;
if (inexact1 != inexact2)
- STD_ERROR2;
+ STD_ERROR2;
- mpfr_set_str_binary (y,
+ mpfr_set_str_binary (y,
"0.10000000000000000000000000000000000000000000000000000E31");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.11111111111111111111111111111111111111111111111111111E30");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
"0.10000000000000000000000000000000000000000000000000000E31");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.11111111111111111111111111111111111111111111111111111E29");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
"0.10000000000000000000000000000000000000000000000000000E52");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.10000000000010000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
- "0.11100000000000000000000000000000000000000000000000000E53");
- mpfr_set_str_binary (z,
- "0.10000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(z, y, z, r);
- mpfr_set(x, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.11100000000000000000000000000000000000000000000000000E53");
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(z, y, z, r);
+ mpfr_set(x, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
"0.10000000000000000000000000000000000000000000000000000E53");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.10100000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
- "0.10000000000000000000000000000000000000000000000000000E54");
- mpfr_set_str_binary (z,
- "0.10100000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- p = 63;
- mpfr_set_prec(x, p);
- mpfr_set_prec(x2, p);
- mpfr_set_prec(y, p);
- mpfr_set_prec(z, p);
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000000000000000000000000E54");
+ mpfr_set_str_binary (z,
+ "0.10100000000000000000000000000000000000000000000000000E00");
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 63;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+ mpfr_set_str_binary (y,
"0.100000000000000000000000000000000000000000000000000000000000000E62");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.110000000000000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- p = 64;
- mpfr_set_prec(x, 64);
- mpfr_set_prec(x2, 64);
- mpfr_set_prec(y, 64);
- mpfr_set_prec(z, 64);
-
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 64;
+ mpfr_set_prec(x, 64);
+ mpfr_set_prec(x2, 64);
+ mpfr_set_prec(y, 64);
+ mpfr_set_prec(z, 64);
+
+ mpfr_set_str_binary (y,
"0.1100000000000000000000000000000000000000000000000000000000000000E31");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.1111111111111111111111111110000000000000000000000000011111111111E29");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
"0.1000000000000000000000000000000000000000000000000000000000000000E63");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.1011000000000000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
"0.1000000000000000000000000000000000000000000000000000000000000000E63");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.1110000000000000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
"0.10000000000000000000000000000000000000000000000000000000000000E63");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.10000000000000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
"0.1000000000000000000000000000000000000000000000000000000000000000E64");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.1010000000000000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- MPFR_SET_NAN(x);
- MPFR_SET_NAN(x2);
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ MPFR_SET_NAN(x);
+ MPFR_SET_NAN(x2);
+ mpfr_set_str_binary (y,
"0.1000000000000000000000000000000000000000000000000000000000000000"
- "E-1073741823");
- mpfr_set_str_binary (z,
+ "E-1073741823");
+ mpfr_set_str_binary (z,
"0.1100000000000000000000000000000000000000000000000000000000000000"
- "E-1073741823");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- p = 9;
- mpfr_set_prec(x, p);
- mpfr_set_prec(x2, p);
- mpfr_set_prec(y, p);
- mpfr_set_prec(z, p);
-
- mpfr_set_str_binary (y, "0.100000000E1");
- mpfr_set_str_binary (z, "0.100000000E-8");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- p = 34;
- mpfr_set_prec(x, p);
- mpfr_set_prec(x2, p);
- mpfr_set_prec(y, p);
- mpfr_set_prec(z, p);
-
- mpfr_set_str_binary (y, "-0.1011110000111100010111011100110100E-18");
- mpfr_set_str_binary (z, "0.1000101010110011010101011110000000E-14");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- p = 124;
- mpfr_set_prec(x, p);
- mpfr_set_prec(x2, p);
- mpfr_set_prec(y, p);
- mpfr_set_prec(z, p);
-
- mpfr_set_str_binary (y,
+ "E-1073741823");
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 9;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y, "0.100000000E1");
+ mpfr_set_str_binary (z, "0.100000000E-8");
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 34;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y, "-0.1011110000111100010111011100110100E-18");
+ mpfr_set_str_binary (z, "0.1000101010110011010101011110000000E-14");
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 124;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y,
"0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E1");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.1011111000100111000011001000011101010101101100101010101001000001110100001101110110001110111010000011101001100010111110001100E-31");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- p = 288;
- mpfr_set_prec(x, p);
- mpfr_set_prec(x2, p);
- mpfr_set_prec(y, p);
- mpfr_set_prec(z, p);
-
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 288;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y,
"0.111000110011000001000111101010111011110011101001101111111110000011100101000001001010110010101010011001010100000001110011110001010101101010001011101110100100001011110100110000101101100011010001001011011010101010000010001101001000110010010111111011110001111101001000101101001100101100101000E80");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"-0.100001111111101001011010001100110010100111001110000110011101001011010100001000000100111011010110110010000000000010101101011000010000110001110010100001100101011100100100001011000100011110000001010101000100011101001000010111100000111000111011001000100100011000100000010010111000000100100111E-258");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- p = 85;
- mpfr_set_prec(x, p);
- mpfr_set_prec(x2, p);
- mpfr_set_prec(y, p);
- mpfr_set_prec(z, p);
-
- mpfr_set_str_binary (y,
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 85;
+ mpfr_set_prec(x, p);
+ mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p);
+ mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y,
"0.1111101110100110110110100010101011101001100010100011110110110010010011101100101111100E-4");
- mpfr_set_str_binary (z,
+ mpfr_set_str_binary (z,
"0.1111101110100110110110100010101001001000011000111000011101100101110100001110101010110E-4");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- p = 64;
- mpfr_set_prec(x, p); mpfr_set_prec(x2, p);
- mpfr_set_prec(y, p); mpfr_set_prec(z, p);
-
- mpfr_set_str_binary (y,
- "0.11000000000000000000000000000000"
- "00000000000000000000000000000000E1");
- mpfr_set_str_binary (z,
- "0.10000000000000000000000000000000"
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ p = 64;
+ mpfr_set_prec(x, p); mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p); mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y,
+ "0.11000000000000000000000000000000"
+ "00000000000000000000000000000000E1");
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000"
"00000000000000000000000000000001E0");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
- "0.11000000000000000000000000000000"
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.11000000000000000000000000000000"
"000000000000000000000000000001E1");
- mpfr_set_str_binary (z,
- "0.10000000000000000000000000000000"
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000"
"00000000000000000000000000000001E0");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- es = mpfr_get_emin ();
- mpfr_set_emin (-1024);
-
- mpfr_set_str_binary (y,
- "0.10000000000000000000000000000000"
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ es = mpfr_get_emin ();
+ set_emin (-1024);
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000"
"000000000000000000000000000000E-1023");
- mpfr_set_str_binary (z,
- "0.10000000000000000000000000000000"
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000"
"00000000000000000000000000000001E-1023");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
-
- mpfr_set_str_binary (y,
- "0.10000000000000000000000000000000"
- "000000000000000000000000000000E-1023");
- mpfr_set_str_binary (z,
- "0.1000000000000000000000000000000"
- "000000000000000000000000000000E-1023");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
- if (mpfr_cmp(x, x2))
- STD_ERROR;
- if (inexact1 != inexact2)
- STD_ERROR2;
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
- mpfr_set_emin(es);
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000"
+ "000000000000000000000000000000E-1023");
+ mpfr_set_str_binary (z,
+ "0.1000000000000000000000000000000"
+ "000000000000000000000000000000E-1023");
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+ set_emin (es);
}
- mpfr_clears(x,y,z,x2,NULL);
+ mpfr_clears(x,y,z,x2,NULL);
}
diff --git a/tests/ttanh.c b/tests/ttanh.c
index c99c8331c..f66aa170c 100644
--- a/tests/ttanh.c
+++ b/tests/ttanh.c
@@ -60,8 +60,8 @@ special_overflow (void)
{
mpfr_t x, y;
- mpfr_set_emin (-125);
- mpfr_set_emax (128);
+ set_emin (-125);
+ set_emax (128);
mpfr_init2 (x, 24);
mpfr_init2 (y, 24);
mpfr_set_str_binary (x, "0.101100100000000000110100E7");
@@ -74,8 +74,8 @@ special_overflow (void)
}
mpfr_clear (y);
mpfr_clear (x);
- mpfr_set_emin (MPFR_EMIN_MIN);
- mpfr_set_emax (MPFR_EMAX_MAX);
+ set_emin (MPFR_EMIN_MIN);
+ set_emax (MPFR_EMAX_MAX);
}
int