summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author(no author) <(no author)@280ebfd0-de03-0410-8827-d642c229c3f4>2003-11-21 13:23:58 +0000
committer(no author) <(no author)@280ebfd0-de03-0410-8827-d642c229c3f4>2003-11-21 13:23:58 +0000
commit106c460c60e3f1a9a47890589532d491fc091c8f (patch)
tree1eae41db56c148139a4a097a2410924a0f28f830
parent7f857964d869e4a3f316a7da845e11a9da0388a5 (diff)
downloadmpfr-2-0-2-rel.tar.gz
This commit was manufactured by cvs2svn to create tagmpfr-2-0-2-rel
'mpfr-2-0-2-rel'. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/tags/mpfr-2-0-2-rel@2561 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--ChangeLog291
-rw-r--r--README11
-rw-r--r--TODO4
-rw-r--r--acosh.c54
-rw-r--r--const_log2.c86
-rw-r--r--const_pi.c28
-rw-r--r--erf.c49
-rw-r--r--gmp_op.c36
-rw-r--r--log1p.c14
-rw-r--r--mpfr.h2
-rw-r--r--mpfr.texi16
-rw-r--r--pow.c14
-rw-r--r--pow_si.c4
-rw-r--r--pow_ui.c37
-rw-r--r--rint.c175
-rw-r--r--tests/Makefile.in920
-rw-r--r--tests/tacosh.c30
-rw-r--r--tests/tasin.c2
-rw-r--r--tests/terf.c39
-rw-r--r--tests/tests.c5
-rw-r--r--tests/tgamma.c2
-rw-r--r--tests/thyperbolic.c284
-rw-r--r--tests/tpow.c16
-rw-r--r--tests/trint.c205
-rw-r--r--tests/tset_ld.c16
-rw-r--r--tests/tui_pow.c46
-rw-r--r--tests/tzeta.c20
27 files changed, 1028 insertions, 1378 deletions
diff --git a/ChangeLog b/ChangeLog
index cc55d227e..c3dff55c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,296 @@
+2003-11-19 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * tests/tui_pow.c, pow.c:
+ Ported Paul's patch (fix and tests) concerning the pow.c bug (in case
+ exact result) to the 2.0.2 branch.
+
+2003-11-14 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * pow_si.c, tests/tpow.c:
+ Ported the pow_si patch (and test) to the 2.0.2 branch.
+
+ * pow.c, tests/tui_pow.c, tests/tzeta.c:
+ Ported the pow.c precision patch to the 2.0.2 branch (with the tests).
+
+ * tests/tset_ld.c:
+ Detect optimization bug of gcc 3.3 on Alpha to avoid a test failure.
+
+2003-11-11 Kevin Ryde <user42@zip.com.au>
+
+ * tests/tests.c (tests_rand_start): Use gmp_randinit_default not the
+ RANDS macro, to cope with new non-seeding MT setup by RANDS.
+
+2003-11-04 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * pow_ui.c:
+ Overflow on err (which is now unsigned) avoided, simplified its
+ computation, added some asserts, fixed the underflow check (the
+ cast to double was useless and could be inexact).
+
+ * tests/tacosh.c: Merged the check_inf test to the 2.0.2 branch.
+
+ * tests/tacosh.c:
+ The check_inf test wasn't called. Added 2 missing mpfr_clear and \n.
+
+ * acosh.c: Special cases rewritten.
+
+2003-10-30 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * log1p.c: MPFR_RET_NAN -> MPFR_RET(0).
+
+2003-10-27 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * tests/thyperbolic.c:
+ Fixes for thyperbolic.c merged to the 2.0.2 branch.
+
+ * tests/thyperbolic.c: Another fix, for acosh(-INF).
+
+ * tests/thyperbolic.c: Fixed exit status.
+
+2003-10-21 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * ChangeLog: Update.
+
+ * const_log2.c, const_pi.c, mpfr.h, TODO:
+ Fixed the mpfr_round bug (the mpfr_round macro hadn't been updated).
+ The ternary value wasn't always set in const_log2.c and const_pi.c.
+ Updated TODO.
+
+ * tests/trint.c: Value of y is displayed when a test fails.
+
+ * tests/trint.c: More tests (showing a bug for mpfr_round).
+
+ * tests/trint.c: More tests for the rounding-to-integer functions.
+
+2003-10-20 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * gmp_op.c: Wrong comment updated.
+
+ * rint.c, tests/trint.c, mpfr.texi:
+ Major update of the function mpfr_rint, including a small semantics
+ change to behave like the C function rint (unless the result is not
+ representable); as a consequence, mpfr_round now calls mpfr_rint with
+ the NEAREST_AWAY internal (to rint.c) rounding mode. Manual updated
+ to reflect this change.
+
+2003-10-17 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * erf.c, tests/terf.c: Fixed ternary value bugs and added tests.
+
+2003-10-16 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * tests/tasin.c, tests/tgamma.c: Added some necessary #include's.
+
+ * tests/trint.c:
+ Added a test against the libc (compiled and performed only when
+ __STDC_VERSION__ >= 199901L), showing a difference between mpfr_rint
+ and the C rint function (the behavior of mpfr_rint will change and
+ the manual will be updated).
+
+ * tests/trint.c:
+ Added mpfr_rint tests (as the behavior of this function will change).
+
+ * ChangeLog: Update.
+
+ * get_d.c, set_d.c: Fixed several bugs.
+
+ * get_d.c: Added XDEBUG support (like in set_d.c).
+
+2003-10-15 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr.texi:
+ Replaced all non-ASCII characters by an equivalent 7-bit sequence
+ to support unpatched texinfo.tex files.
+
+2003-10-15 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * tests/reuse.c: removed #define DEBUG (turned on accidentally)
+
+2003-10-15 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * BUGS:
+ Bug on the ternary value was fixed by Paul Zimmermann on 2003-10-14.
+
+2003-10-14 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * mpfr.texi: added preamble about ternary flag for special functions
+
+ * tests/reuse.c, tests/tacos.c, tests/tagm.c, tests/tasin.c, tests/tatan.c, tests/terf.c, tests/texp.c, tests/tgamma.c, tests/tgeneric.c, tests/thypot.c, tests/tzeta.c:
+ now uses #include "tgeneric.c" everywhere
+ (and modified test_generic to check also the inexact flag)
+
+ * tests/tui_div.c: check_nan() is back
+
+ * tests/tlog.c: removed old unused code
+
+ * tests/thyperbolic.c: fixed tests for x=0
+ removed composition tests (were already in-between #if 0 ... #endif)
+
+ * pow.c, pow_si.c, pow_ui.c, sin.c, sinh.c, sqrt.c, tan.c, tanh.c, ui_pow_ui.c, zeta.c, factorial.c, gamma.c, hypot.c, log.c, log10.c, log1p.c, log2.c, asinh.c, atan.c, atanh.c, const_euler.c, const_log2.c, const_pi.c, cos.c, cosh.c, erf.c, exp2.c, expm1.c, acos.c, acosh.c, agm.c, asin.c:
+ replaced mpfr_can_round (approx, err, rnd1, GMP_RNDN, prec)
+ by mpfr_can_round (approx, err, rnd1, GMP_RNDZ, prec + 1)
+ which in addition guarantees a correct inexact flag
+
+ * TODO: added new items (version number, rounding modes)
+
+ * README.dev: added comment about --enable-alloca=debug
+
+2003-10-13 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * BUGS: added section "Problems due to compiler bugs"
+
+ * exp3.c, exp_2.c:
+ change in can_round calls to get correct inexact flag for rounding to nearest
+
+2003-10-10 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * pow.c, tests/tpow.c:
+ fixed bug in mpfr_pow found by Ming J. Tsai (overflow)
+
+2003-10-08 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * acos.c, asin.c, atan.c:
+ Removed useless inclusion of standard headers and some #ifdef DEBUG
+ code. Partial reindentation.
+
+ * strncasecmp.c: Added a #include <stddef.h> because size_t is used.
+
+2003-10-07 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * tests/tabs.c, tests/tacos.c, tests/tadd.c, tests/tasin.c, tests/tatan.c, tests/tcmp.c, tests/tconst_log2.c, tests/tdiv.c, tests/tfactorial.c, tests/tfrac.c, tests/tgamma.c, tests/tget_str.c, tests/tlog10.c, tests/tlog1p.c, tests/tpow3.c, tests/tset_d.c, tests/tset_si.c, tests/tset_str.c, tests/tset_z.c, tests/tsub.c, tests/tui_pow.c, tests/tzeta.c, tests/tsin.c:
+ reduced test time
+
+2003-10-06 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * round_prec.c: fixed comment of mpfr_round_raw_generic
+
+ * add1.c, extract.c, get_si.c, get_ui.c:
+ replaced ABSSIZE by ESIZE (ABSSIZE is the allocated size, and should be
+ used only in functions init, set_prec, round_prec)
+
+ * tests/tadd.c: fixed bug in allocation for in-place operation
+
+ * asin.c, atan.c:
+ inexact flag should now be correct for directed rounding
+ fixed a bug for mpfr_atan(-Inf) [gave +Pi/2 instead of -Pi/2]
+
+ * tests/tatan.c: added test for atan(-Inf)
+
+ * set_ld.c: use macros to avoid possible problem with float input
+
+ * TODO: new proposal for mpfr_can_round
+
+ * mpfr.texi: mpfr_mul_2exp/mpfr_div_2exp are not obsolete
+
+2003-10-05 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr.texi:
+ Clearer mpfr_eq documentation (thanks to Kevin Ryde for the remark).
+
+2003-10-03 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr-impl.h:
+ MPFR_ASSERTN rewritten to avoid "statement with no effect" warnings
+ with gcc when the assertion is always true.
+
+ * add1.c:
+ Optimization (thanks to Patrick Pelissier), as the allocated size
+ may be larger than the size used by the significant bits.
+
+ * mpfr.texi, INSTALL: Updated installation notes.
+
+ * cmp_abs.c, mpfr.texi:
+ Infinities are now accepted in mpfr_cmpabs. Updated its definition
+ in the source (no longer sign(abs(b) - abs(c))).
+
+2003-10-02 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr.texi: Use @url{} for URLs.
+
+ * mpfr.texi: As suggested by PZ:
+ o documentation of mpfr_fits_* functions moved to the section
+ on conversions;
+ o grouped some mpfr_pow special cases;
+ o explanation concerning the meaning of rnd in mpfr_frac.
+
+ * tests/tset_str.c, tests/tset_z.c, tests/tsinh.c, tests/tsqrt.c, tests/tsub.c, tests/ttanh.c, tests/tui_pow.c, tests/tui_sub.c, tests/tzeta.c, tests/tmul.c, tests/tmul_ui.c, tests/tout_str.c, tests/tpow.c, tests/tset.c, tests/tset_d.c, tests/tlog.c, tests/tlog10.c, tests/tlog1p.c, tests/tlog2.c, tests/texpm1.c, tests/tfma.c, tests/tget_str.c, tests/thypot.c, tests/tadd.c, tests/tadd_ui.c, tests/tagm.c, tests/tasinh.c, tests/tatan.c, tests/tatanh.c, tests/tcan_round.c, tests/tcmp.c, tests/tcmp2.c, tests/tcos.c, tests/tcosh.c, tests/tdiv.c, tests/tdiv_ui.c, tests/terf.c, tests/texceptions.c, tests/texp.c, mpfr.h, mpfr.texi, print_raw.c, set_str_raw.c, tests/tacosh.c, BUGS, mpfr-impl.h:
+ Updated documentation. In particular, mpfr_set_str_raw renamed
+ as mpfr_set_str_binary. This function and mpfr_print_binary are
+ now internal functions. mpfr_print_binary no longer prints the
+ non-significant 0 bits. Updated the source to match the manual.
+ mpfr_print_binary has been completely rewritten (now directly
+ prints to stdout, without using an intermediate string). In
+ mpfr_set_str_binary, replaced atol by strtol + error checking.
+
+2003-10-02 Paul Zimmermann <Paul.Zimmermann@loria.fr>
+
+ * mpfr.texi: added paragraph on support/grants
+ added help for mpfr_erf
+
+2003-10-02 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr.texi:
+ Make node titles match section titles, and updated menus and xrefs.
+ Added a line break after @samp{uninstall}.
+
+2003-10-01 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * TODO, const_log2.c, const_pi.c, mpfr.h, mpfr.texi, zeta.c:
+ Corrections in the MPFR manual (PZ & VL). Functions mpfr_const_pi,
+ mpfr_const_log2 and mpfr_zeta now return a ternary value. Updated
+ TODO file.
+
+2003-09-30 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * BUGS: Added a bug related to the ternary value and worst cases.
+
+ * pow_si.c, pow_ui.c: Added exponent range support.
+
+ * mpfr.texi: Corrections up to Section 5.6 (PZ & VL).
+
+ * get_z_exp.c:
+ Re-added the assert on the exponent, but replacing MPFR_EMIN_MIN by
+ MP_EXP_T_MIN (this makes more sense): an assertion failed would mean
+ that the exponent is not representable (an undefined behavior in the
+ ISO C standard). If need be, we could choose to return MP_EXP_T_MIN
+ in such a case, or perhaps MP_EXP_T_MAX to signal an error. The
+ mantissa would still be meaningful.
+
+2003-09-30 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * TODO: Update TODO & mpfr_set_prec.
+
+2003-09-29 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr.texi: Corrections up to Section 4.
+
+ * AUTHORS: Added authors Kevin Ryde and Patrick Pelissier.
+
+ * INSTALL: Removed "known problems" that are no longer problems.
+
+2003-09-26 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * BUGS: Removed bugs related to the tests and to the exponents
+ as they no longer occur. Updated some potentials bugs.
+
2003-09-25 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+ * mpfr-impl.h, mpfr.h, mpfr.texi, tests/tinits.c:
+ Removed mpfr_inits, mpfr_inits2, mpfr_clears from the documentation.
+ Moved their prototypes to mpfr-impl.h (internal functions until
+ decided otherwise).
+
+2003-09-25 Patrick Pelissier <Patrick.Pelissier@loria.fr>
+
+ * const_log2.c, const_pi.c, generic.c, atan.c:
+ Modify 'r' arg of GENERIC from int to long (min 32 bits).
+
+2003-09-25 Vincent Lefevre <Vincent.Lefevre@loria.fr>
+
+ * mpfr.texi: 8-bit ISO-8859-1 characters + consistent spelling.
+
+ * ChangeLog: Update.
+
* tests/tgeneric.c, tests/tget_d.c, tests/tget_str.c, tests/thypot.c, tests/tisnan.c, tests/tlog.c, tests/tlog10.c, tests/tmul.c, tests/tmul_2exp.c, tests/tmul_ui.c, tests/tout_str.c, tests/tpow.c, tests/tpow3.c, tests/trandom.c, tests/tconst_pi.c, tests/tcos.c, tests/tdiv.c, tests/tdiv_ui.c, tests/teq.c, tests/terf.c, tests/tests.c, tests/texceptions.c, tests/texp.c, tests/texp2.c, tests/tfactorial.c, tests/tfma.c, tests/tfrac.c, tests/tgamma.c, tests/mpf_compat.h, tests/reuse.c, tests/tabs.c, tests/tacos.c, tests/tadd.c, tests/tagm.c, tests/tasin.c, tests/tatan.c, tests/tcan_round.c, tests/tcbrt.c, tests/tcmp.c, tests/tcmp2.c, tests/tcmp_d.c, tests/tcmp_ui.c, tests/tconst_log2.c:
Changed the remaining stderr to stdout.
diff --git a/README b/README
index 2180ce51a..86b70e3a7 100644
--- a/README
+++ b/README
@@ -30,22 +30,25 @@ COPYING - the GNU General Public License, version 2
COPYING.LIB - the GNU Lesser General Public License, version 2.1
ChangeLog - the log of changes
INSTALL - how to install MPFR (see also mpfr.texi)
-Makefile* - files for building the library
+Makefile.* - files for building the library
NEWS - new features with respect to previous versions
README - this file
TODO - what remains to do (any help is welcome!)
VERSION - version of MPFR (next release version if taken from CVS)
ac*.m4 - automatic configuration files
*.c - source files
-configure* - configuration files
+config* - configuration files
+depcomp - compile a program generating dependencies as side-effects
fdl.texi - the GNU Free Documentation License
-install* - installation files
+fits_s.h - source file
+fits_u.h - source file
+install-sh - installation file
+log_b2.h - header file for mpfr_get_str and mpfr_set_str
missing - auxiliary installation file
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
diff --git a/TODO b/TODO
index 18d96ef36..bca377d7f 100644
--- a/TODO
+++ b/TODO
@@ -173,10 +173,12 @@ Miscellaneous:
add one ulp to the mantissa.
- add a new rounding mode: round to nearest, with ties away from zero
- (will be in 754r)
+ (will be in 754r, could be used by mpfr_round)
- check/define the sign of infinity for gamma(-integer)
+- add tests of the ternary value for constants
+
Reentrancy / Thread-Safety:
- Temporary changes to emin/emax are not safe (all uses of
diff --git a/acosh.c b/acosh.c
index 20539a81f..2e6603a34 100644
--- a/acosh.c
+++ b/acosh.c
@@ -30,48 +30,47 @@ MA 02111-1307, USA. */
*/
int
-mpfr_acosh (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode)
+mpfr_acosh (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
-
+
int inexact = 0;
int comp;
- if (MPFR_IS_NAN(x) || (comp = mpfr_cmp_ui (x, 1)) < 0)
+ if (MPFR_IS_NAN (x) || (comp = mpfr_cmp_ui (x, 1)) < 0)
{
- MPFR_SET_NAN(y);
+ MPFR_SET_NAN (y);
MPFR_RET_NAN;
}
-
- MPFR_CLEAR_NAN(y);
- if (comp == 0)
+ MPFR_SET_POS (y);
+
+ if (MPFR_IS_INF (x))
{
- MPFR_SET_ZERO(y); /* acosh(1) = 0 */
- MPFR_SET_POS(y);
- MPFR_RET(0);
- }
-
- if (MPFR_IS_INF(x))
- {
- MPFR_SET_INF(y);
- MPFR_SET_POS(y);
- MPFR_RET(0);
+ MPFR_CLEAR_FLAGS (y);
+ MPFR_SET_INF (y);
+ MPFR_RET (0);
}
- MPFR_CLEAR_INF(y);
+ MPFR_CLEAR_FLAGS (y);
+
+ if (comp == 0)
+ {
+ MPFR_SET_ZERO (y); /* acosh(1) = 0 */
+ MPFR_RET (0);
+ }
/* General case */
{
/* Declaration of the intermediary variables */
mpfr_t t, te, ti;
-
+
/* Declaration of the size variables */
mp_prec_t Nx = MPFR_PREC(x); /* Precision of input variable */
mp_prec_t Ny = MPFR_PREC(y); /* Precision of output variable */
-
+
mp_prec_t Nt; /* Precision of the intermediary variable */
int err; /* Precision of error */
-
+
/* compute the precision of intermediary variable */
Nt = MAX(Nx, Ny);
/* the optimal number of bits : see algorithms.ps */
@@ -110,7 +109,7 @@ mpfr_acosh (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode)
}
while ((err < 0) || !mpfr_can_round (t, err, GMP_RNDN, GMP_RNDZ,
Ny + (rnd_mode == GMP_RNDN)));
-
+
inexact = mpfr_set (y, t, rnd_mode);
mpfr_clear (t);
@@ -122,14 +121,3 @@ mpfr_acosh (mpfr_ptr y, mpfr_srcptr x , mp_rnd_t rnd_mode)
return mpfr_check_range (y, inexact, rnd_mode);
}
-
-
-
-
-
-
-
-
-
-
-
diff --git a/const_log2.c b/const_log2.c
index 9e5761203..5b4eef024 100644
--- a/const_log2.c
+++ b/const_log2.c
@@ -59,53 +59,53 @@ mpfr_const_aux_log2 (mpfr_ptr mylog, mp_rnd_t rnd_mode)
mp_prec_t prec;
mpfr_t tmp1, tmp2, result,tmp3;
mpz_t cst;
- int good = 0;
int logn;
mp_prec_t prec_i_want = MPFR_PREC(mylog);
mp_prec_t prec_x;
- int inexact;
+ int inexact = 0; /* here, 0 means not set */
- mpz_init(cst);
- logn = __gmpfr_ceil_log2 ((double) MPFR_PREC(mylog));
+ mpz_init (cst);
+ logn = __gmpfr_ceil_log2 ((double) MPFR_PREC(mylog));
prec_x = prec_i_want + logn;
- while (!good){
- prec = __gmpfr_ceil_log2 ((double) prec_x);
- mpfr_init2(tmp1, prec_x);
- mpfr_init2(result, prec_x);
- mpfr_init2(tmp2, prec_x);
- mpfr_init2(tmp3, prec_x);
- mpz_set_ui(cst, 1);
- mpfr_aux_log2(tmp1, cst, 4, prec-2);
- mpfr_div_2ui(tmp1, tmp1, 4, GMP_RNDD);
- mpfr_mul_ui(tmp1, tmp1, 15, GMP_RNDD);
-
- mpz_set_ui(cst, 3);
- mpfr_aux_log2(tmp2, cst, 7, prec-2);
- mpfr_div_2ui(tmp2, tmp2, 7, GMP_RNDD);
- mpfr_mul_ui(tmp2, tmp2, 5*3, GMP_RNDD);
- mpfr_sub(result, tmp1, tmp2, GMP_RNDD);
-
- mpz_set_ui(cst, 13);
- mpfr_aux_log2(tmp3, cst, 8, prec-2);
- mpfr_div_2ui(tmp3, tmp3, 8, GMP_RNDD);
- mpfr_mul_ui(tmp3, tmp3, 3*13, GMP_RNDD);
- mpfr_sub(result, result, tmp3, GMP_RNDD);
-
- mpfr_clear(tmp1);
- mpfr_clear(tmp2);
- mpfr_clear(tmp3);
- if (mpfr_can_round (result, prec_x, GMP_RNDD, GMP_RNDZ,
- prec_i_want + (rnd_mode == GMP_RNDN)))
- {
- inexact = mpfr_set (mylog, result, rnd_mode);
- good = 1;
- }
- else
- {
- prec_x += logn;
- }
- mpfr_clear (result);
- }
+ while (!inexact)
+ {
+ prec = __gmpfr_ceil_log2 ((double) prec_x);
+ mpfr_init2 (tmp1, prec_x);
+ mpfr_init2 (result, prec_x);
+ mpfr_init2 (tmp2, prec_x);
+ mpfr_init2 (tmp3, prec_x);
+ mpz_set_ui (cst, 1);
+ mpfr_aux_log2 (tmp1, cst, 4, prec-2);
+ mpfr_div_2ui (tmp1, tmp1, 4, GMP_RNDD);
+ mpfr_mul_ui (tmp1, tmp1, 15, GMP_RNDD);
+
+ mpz_set_ui (cst, 3);
+ mpfr_aux_log2 (tmp2, cst, 7, prec-2);
+ mpfr_div_2ui (tmp2, tmp2, 7, GMP_RNDD);
+ mpfr_mul_ui (tmp2, tmp2, 5*3, GMP_RNDD);
+ mpfr_sub (result, tmp1, tmp2, GMP_RNDD);
+
+ mpz_set_ui (cst, 13);
+ mpfr_aux_log2 (tmp3, cst, 8, prec-2);
+ mpfr_div_2ui (tmp3, tmp3, 8, GMP_RNDD);
+ mpfr_mul_ui (tmp3, tmp3, 3*13, GMP_RNDD);
+ mpfr_sub (result, result, tmp3, GMP_RNDD);
+
+ mpfr_clear (tmp1);
+ mpfr_clear (tmp2);
+ mpfr_clear (tmp3);
+ if (mpfr_can_round (result, prec_x, GMP_RNDD, GMP_RNDZ,
+ prec_i_want + (rnd_mode == GMP_RNDN)))
+ {
+ inexact = mpfr_set (mylog, result, rnd_mode);
+ MPFR_ASSERTN (inexact != 0);
+ }
+ else
+ {
+ prec_x += logn;
+ }
+ mpfr_clear (result);
+ }
mpz_clear (cst);
return inexact;
}
@@ -170,7 +170,7 @@ mpfr_const_log2 (mpfr_ptr x, mp_rnd_t rnd_mode)
mpz_add (s, s, u);
}
- mpfr_set_z (x, s, rnd_mode);
+ inexact = mpfr_set_z (x, s, rnd_mode);
MPFR_SET_EXP (x, MPFR_GET_EXP (x) - N);
mpz_clear (s);
mpz_clear (t);
diff --git a/const_pi.c b/const_pi.c
index e97bc02f6..7c7034d0d 100644
--- a/const_pi.c
+++ b/const_pi.c
@@ -19,8 +19,6 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-#include <stdio.h>
-#include <stdlib.h>
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
@@ -47,17 +45,17 @@ static int
mpfr_pi_machin3 (mpfr_ptr mylog, mp_rnd_t rnd_mode)
{
int prec, logn, prec_x;
- int prec_i_want=MPFR_PREC(mylog);
- int good = 0;
- mpfr_t tmp1, tmp2, result,tmp3,tmp4,tmp5,tmp6;
+ int prec_i_want;
+ mpfr_t tmp1, tmp2, result, tmp3, tmp4, tmp5, tmp6;
mpz_t cst;
- int inex;
+ int inex = 0; /* here, 0 means not set */
- MPFR_CLEAR_FLAGS(mylog);
- logn = __gmpfr_ceil_log2 ((double) MPFR_PREC(mylog));
+ MPFR_CLEAR_FLAGS (mylog);
+ prec_i_want = MPFR_PREC (mylog);
+ logn = __gmpfr_ceil_log2 ((double) prec_i_want);
prec_x = prec_i_want + logn + 5;
- mpz_init(cst);
- while (!good)
+ mpz_init (cst);
+ while (!inex)
{
prec = __gmpfr_ceil_log2 ((double) prec_x);
@@ -110,7 +108,7 @@ mpfr_pi_machin3 (mpfr_ptr mylog, mp_rnd_t rnd_mode)
prec_i_want + (rnd_mode == GMP_RNDN)))
{
inex = mpfr_set (mylog, result, rnd_mode);
- good = 1;
+ MPFR_ASSERTN (inex != 0);
}
else
{
@@ -218,15 +216,11 @@ mpfr_const_pi (mpfr_ptr x, mp_rnd_t rnd_mode)
mpz_fdiv_q(tmp, tmp, den);
mpz_add(pi, pi, tmp);
}
- mpfr_set_z (x, pi, rnd_mode);
+ inex = mpfr_set_z (x, pi, rnd_mode);
mpfr_init2 (y, mpfr_get_prec(x));
mpz_add_ui (pi, pi, N+1);
mpfr_set_z (y, pi, rnd_mode);
- if (mpfr_cmp (x, y) != 0)
- {
- fprintf(stderr, "does not converge\n");
- exit(1);
- }
+ MPFR_ASSERTN (mpfr_cmp (x, y) == 0);
MPFR_SET_EXP (x, MPFR_GET_EXP(x) - 4*N);
mpz_clear(pi);
mpz_clear(num);
diff --git a/erf.c b/erf.c
index 600e0a6d9..8499ab260 100644
--- a/erf.c
+++ b/erf.c
@@ -29,14 +29,14 @@ MA 02111-1307, USA. */
#define EXP1 2.71828182845904523536 /* exp(1) */
-int mpfr_erf_0 _PROTO((mpfr_ptr, mpfr_srcptr, mp_rnd_t));
+int mpfr_erf_0 _PROTO((mpfr_ptr, mpfr_srcptr, mp_rnd_t));
#if 0
-int mpfr_erf_inf _PROTO((mpfr_ptr, mpfr_srcptr, mp_rnd_t));
+int mpfr_erf_inf _PROTO((mpfr_ptr, mpfr_srcptr, mp_rnd_t));
int mpfr_erfc_inf _PROTO((mpfr_ptr, mpfr_srcptr, mp_rnd_t));
#endif
-int
-mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
+int
+mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
double xf;
int sign_x;
@@ -80,11 +80,15 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
if (xf > n * LOG2) /* |erf x| = 1 or 1- */
{
- mpfr_set_ui (y, 1, rnd2);
- if (rnd2 == GMP_RNDD || rnd2 == GMP_RNDZ)
+ if (rnd2 == GMP_RNDN || rnd2 == GMP_RNDU)
{
- mpfr_sub_one_ulp (y, GMP_RNDZ); /* 1 - 2^(1-n) */
- mpfr_add_one_ulp (y, GMP_RNDU);
+ mpfr_set_ui (y, 1, rnd2);
+ inex = 1;
+ }
+ else
+ {
+ mpfr_setmax (y, 0);
+ inex = -1;
}
}
else /* use Taylor */
@@ -93,9 +97,14 @@ mpfr_erf (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
}
if (sign_x < 0)
- MPFR_CHANGE_SIGN(y);
-
- return inex;
+ {
+ MPFR_CHANGE_SIGN (y);
+ return - inex;
+ }
+ else
+ {
+ return inex;
+ }
}
/* return x*2^e */
@@ -104,7 +113,7 @@ double mul_2exp (double x, mp_exp_t e)
{
if (e > 0)
{
- while (e--)
+ while (e--)
x *= 2.0;
}
else
@@ -123,8 +132,8 @@ double mul_2exp (double x, mp_exp_t e)
Assumes x is neither NaN nor infinite nor zero.
Assumes also that e*x^2 <= n (target precision).
*/
-int
-mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd_mode)
+int
+mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
mp_prec_t n, m;
mp_exp_t nuk, sigmak;
@@ -178,7 +187,7 @@ mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd_mode)
break;
/* tauk <- 1/2 + tauk * 2^sigmak + (1+8k)*2^nuk */
- tauk = 0.5 + mul_2exp (tauk, sigmak)
+ tauk = 0.5 + mul_2exp (tauk, sigmak)
+ mul_2exp (1.0 + 8.0 * (double) k, nuk);
}
@@ -224,7 +233,7 @@ mpfr_erf_0 (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd_mode)
f(x) >= f(sqrt(2/e)) ~ 0.7142767512, thus the final partial sum
should be > 0.5, and MPFR_EXP(s) should always be >= 0.
*/
-int
+int
mpfr_erfc_inf (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd)
{
mp_prec_t n, m;
@@ -236,7 +245,7 @@ mpfr_erfc_inf (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd)
double xf = mpfr_get_d1 (x);
n = MPFR_PREC(res); /* target precision */
-
+
mpfr_init2 (y, 2);
mpfr_init2 (s, 2);
mpfr_init2 (t, 2);
@@ -286,7 +295,7 @@ mpfr_erfc_inf (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd)
break;
/* tauk <- 1/2 + tauk * 2^sigmak + 2^(2k+2+nuk) */
- tauk = 0.5 + mul_2exp (tauk, sigmak)
+ tauk = 0.5 + mul_2exp (tauk, sigmak)
+ mul_2exp (1.0, 2 * k + 2 + nuk);
}
@@ -301,7 +310,7 @@ mpfr_erfc_inf (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd)
mpfr_sqrt (y, y, GMP_RNDD);
mpfr_mul (t, t, y, GMP_RNDN);
mpfr_div (s, s, t, GMP_RNDN);
-
+
/* final error bound on s */
tauk = mul_2exp (3.0, nuk + 5) + 2.0 * tauk + 115.0;
log2tauk = __gmpfr_ceil_log2 (tauk);
@@ -321,7 +330,7 @@ mpfr_erfc_inf (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd)
Assumes x is neither NaN nor infinite nor zero.
Assumes also that e*x^2 > n (target precision).
*/
-int
+int
mpfr_erf_inf (mpfr_ptr res, mpfr_srcptr x, mp_rnd_t rnd)
{
mp_prec_t n, m;
diff --git a/gmp_op.c b/gmp_op.c
index d675db8e9..d5d035bea 100644
--- a/gmp_op.c
+++ b/gmp_op.c
@@ -1,6 +1,6 @@
-/* mpfr_cos -- cosine of a floating-point number
+/* Implementations of operations between mpfr and mpz/mpq data
-Copyright 2001 Free Software Foundation, Inc.
+Copyright 2001, 2003 Free Software Foundation, Inc.
This file is part of the MPFR Library.
@@ -25,8 +25,8 @@ MA 02111-1307, USA. */
#include "mpfr.h"
#include "mpfr-impl.h"
-int
-mpfr_mul_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z,mp_rnd_t rnd_mode)
+int
+mpfr_mul_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z,mp_rnd_t rnd_mode)
{
mpfr_t t;
int res;
@@ -37,8 +37,8 @@ mpfr_mul_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z,mp_rnd_t rnd_mode)
return(res);
}
-int
-mpfr_div_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd_mode)
+int
+mpfr_div_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd_mode)
{
mpfr_t t;
int res;
@@ -49,8 +49,8 @@ mpfr_div_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd_mode)
return(res);
}
-int
-mpfr_add_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd_mode)
+int
+mpfr_add_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd_mode)
{
mpfr_t t;
int res;
@@ -61,8 +61,8 @@ mpfr_add_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mp_rnd_t rnd_mode)
return(res);
}
-int
-mpfr_sub_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z,mp_rnd_t rnd_mode)
+int
+mpfr_sub_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z,mp_rnd_t rnd_mode)
{
mpfr_t t;
int res;
@@ -73,8 +73,8 @@ mpfr_sub_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z,mp_rnd_t rnd_mode)
return(res);
}
-int
-mpfr_mul_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mp_rnd_t rnd_mode)
+int
+mpfr_mul_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mp_rnd_t rnd_mode)
{
mpfr_t t;
int res;
@@ -85,8 +85,8 @@ mpfr_mul_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mp_rnd_t rnd_mode)
return(res);
}
-int
-mpfr_div_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
+int
+mpfr_div_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
{
mpfr_t t;
int res;
@@ -97,8 +97,8 @@ mpfr_div_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
return(res);
}
-int
-mpfr_add_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
+int
+mpfr_add_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
{
mpfr_t t;
int res;
@@ -109,8 +109,8 @@ mpfr_add_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z, mp_rnd_t rnd_mode)
return(res);
}
-int
-mpfr_sub_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mp_rnd_t rnd_mode)
+int
+mpfr_sub_q (mpfr_ptr y, mpfr_srcptr x, mpq_srcptr z,mp_rnd_t rnd_mode)
{
mpfr_t t;
int res;
diff --git a/log1p.c b/log1p.c
index 7bd641f7a..f655bf5a2 100644
--- a/log1p.c
+++ b/log1p.c
@@ -34,9 +34,9 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
int comp, inexact = 0;
- if (MPFR_IS_NAN(x))
+ if (MPFR_IS_NAN(x))
{
- MPFR_SET_NAN(y);
+ MPFR_SET_NAN(y);
MPFR_RET_NAN;
}
@@ -60,7 +60,7 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
comp = mpfr_cmp_si(x,-1);
/* x<-1 undefined */
- if (comp < 0)
+ if (comp < 0)
{
MPFR_SET_NAN(y);
MPFR_RET_NAN;
@@ -70,7 +70,7 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
MPFR_SET_INF(y);
MPFR_SET_POS(y);
- MPFR_RET_NAN;
+ MPFR_RET(0);
}
MPFR_CLEAR_INF(y);
@@ -90,10 +90,10 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
/* Declaration of the size variable */
mp_prec_t Nx = MPFR_PREC(x); /* Precision of input variable */
mp_prec_t Ny = MPFR_PREC(y); /* Precision of input variable */
-
+
mp_prec_t Nt; /* Precision of the intermediary variable */
long int err; /* Precision of error */
-
+
/* compute the precision of intermediary variable */
Nt = MAX(Nx,Ny);
/* the optimal number of bits : see algorithms.ps */
@@ -107,7 +107,7 @@ mpfr_log1p (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
{
/* reactualisation of the precision */
mpfr_set_prec (t, Nt);
-
+
/* compute log1p */
mpfr_add_ui (t, x, 1, GMP_RNDN); /* 1+x */
mpfr_log (t, t, GMP_RNDN); /* log(1+x)*/
diff --git a/mpfr.h b/mpfr.h
index f8e18594c..f28838511 100644
--- a/mpfr.h
+++ b/mpfr.h
@@ -336,7 +336,7 @@ int mpfr_unordered_p _PROTO ((mpfr_srcptr, mpfr_srcptr));
#define mpfr_inexflag_p() \
((int) (__gmpfr_flags & MPFR_FLAGS_INEXACT))
-#define mpfr_round(a,b) mpfr_rint((a), (b), GMP_RNDN)
+#define mpfr_round(a,b) mpfr_rint((a), (b), -1)
#define mpfr_trunc(a,b) mpfr_rint((a), (b), GMP_RNDZ)
#define mpfr_ceil(a,b) mpfr_rint((a), (b), GMP_RNDU)
#define mpfr_floor(a,b) mpfr_rint((a), (b), GMP_RNDD)
diff --git a/mpfr.texi b/mpfr.texi
index f7ea1dfa4..31aa945ef 100644
--- a/mpfr.texi
+++ b/mpfr.texi
@@ -3,7 +3,7 @@
@setfilename mpfr.info
@documentencoding ISO-8859-1
@set VERSION 2.0.2
-@set UPDATED-MONTH October 2003
+@set UPDATED-MONTH November 2003
@settitle MPFR @value{VERSION}
@synindex tp fn
@iftex
@@ -1367,19 +1367,27 @@ Return the number of bytes read, or if an error occurred, return 0.
@deftypefunx int mpfr_floor (mpfr_t @var{rop}, mpfr_t @var{op})
@deftypefunx int mpfr_round (mpfr_t @var{rop}, mpfr_t @var{op})
@deftypefunx int mpfr_trunc (mpfr_t @var{rop}, mpfr_t @var{op})
-Set @var{rop} to @var{op} rounded to an integer. @code{mpfr_ceil} rounds
+Set @var{rop} to @var{op} rounded to an integer.
+@code{mpfr_rint} rounds to the nearest representable integer in the
+given rounding mode, @code{mpfr_ceil} rounds
to the next higher or equal representable integer, @code{mpfr_floor} to
the next lower or equal representable integer, @code{mpfr_round} to the
nearest representable integer, rounding halfway cases away from zero,
and @code{mpfr_trunc} to the next representable integer towards zero.
-@code{mpfr_rint} behaves like one of these four functions, depending
-on the rounding mode.
+
The returned value is zero when the result is exact, positive when it is
greater than the original value of @var{op}, and negative when it is smaller.
More precisely, the returned value is 0 when @var{op} is an integer
representable in @var{rop}, 1 or @minus{}1 when @var{op} is an integer
that is not representable in @var{rop}, 2 or @minus{}2 when @var{op} is
not an integer.
+
+Note that @code{mpfr_round} is different from @code{mpfr_rint} called with
+the rounding to the nearest mode (where halfway cases are rounded to an even
+integer or mantissa). Note also that no double rounding is performed; for
+instance, 4.5 (100.1 in binary) is rounded by @code{mpfr_round} to 4 (100
+in binary) in 2-bit precision, though @code{round(4.5)} is equal to 5 and
+5 (101 in binary) is rounded to 6 (110 in binary) in 2-bit precision.
@end deftypefun
@deftypefun int mpfr_frac (mpfr_t @var{rop}, mpfr_t @var{op}, mp_rnd_t @var{rnd})
diff --git a/pow.c b/pow.c
index 27244593c..784893e89 100644
--- a/pow.c
+++ b/pow.c
@@ -147,7 +147,7 @@ is_odd (mpfr_srcptr y)
int
mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
{
- int inexact = 0;
+ int inexact = 1;
/* pow(x, ±0) returns 1 for any x, even a NaN. */
if (MPFR_IS_FP(y) && MPFR_IS_ZERO(y))
@@ -317,6 +317,7 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
/* compute the precision of intermediary variable */
Nt = MAX(Nx, Ny);
+ Nt = MAX(Nt, Nz); /* take account of the output precision too! */
/* the optimal number of bits : see algorithms.ps */
Nt = Nt + 5 + __gmpfr_ceil_log2 (Nt);
@@ -354,11 +355,18 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd_mode)
/* check exact power */
if (ok == 0 && loop == 1)
- ok = mpfr_pow_is_exact (x, y);
+ {
+ ok = mpfr_pow_is_exact (x, y);
+ if (ok)
+ inexact = 0;
+ }
}
while (err < 0 || ok == 0);
- inexact = mpfr_set (z, t, rnd_mode);
+ if (inexact)
+ inexact = mpfr_set (z, t, rnd_mode);
+ else /* result is exact: round to nearest and return inexact=0 */
+ mpfr_set (z, t, GMP_RNDN);
mpfr_clear (t);
mpfr_clear (ti);
diff --git a/pow_si.c b/pow_si.c
index df49f48c5..adc0cc042 100644
--- a/pow_si.c
+++ b/pow_si.c
@@ -74,8 +74,10 @@ mpfr_pow_si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd_mode)
/* detect exact powers: x^(-n) is exact iff x is a power of 2 */
if (mpfr_cmp_si_2exp (x, MPFR_SIGN(x), MPFR_EXP(x) - 1) == 0)
{
+ mp_exp_t expx = MPFR_EXP(x); /* warning: x and y may be the same
+ variable */
mpfr_set_si (y, (n % 2) ? MPFR_SIGN(x) : 1, rnd_mode);
- MPFR_EXP(y) += n * (MPFR_EXP(x) - 1);
+ MPFR_EXP(y) += n * (expx - 1);
return 0;
}
diff --git a/pow_ui.c b/pow_ui.c
index aa8db2020..1c2051702 100644
--- a/pow_ui.c
+++ b/pow_ui.c
@@ -29,10 +29,9 @@ MA 02111-1307, USA. */
int
mpfr_pow_ui (mpfr_ptr x, mpfr_srcptr y, unsigned long int n, mp_rnd_t rnd)
{
- long int i, err;
unsigned long m;
mpfr_t res;
- mp_prec_t prec;
+ mp_prec_t prec, err;
int inexact;
mp_rnd_t rnd1;
@@ -79,33 +78,35 @@ mpfr_pow_ui (mpfr_ptr x, mpfr_srcptr y, unsigned long int n, mp_rnd_t rnd)
do
{
+ int i;
+
prec += 3;
- for (m=n, i=0; m; i++, m>>=1, prec++);
+ for (m = n, i = 0; m; i++, m >>= 1, prec++)
+ ;
mpfr_set_prec (res, prec);
inexact = mpfr_set (res, y, rnd1);
- err = 1;
+ err = prec <= i ? 0 : prec - i;
+ MPFR_ASSERTD (i >= 1);
/* now 2^(i-1) <= n < 2^i */
- for (i-=2; i>=0; i--)
- {
- if (mpfr_mul (res, res, res, GMP_RNDU))
- inexact = 1;
- err++;
- if (n & (1UL << i))
- if (mpfr_mul (res, res, y, rnd1))
- inexact = 1;
- }
+ for (i -= 2; i >= 0; i--)
+ {
+ if (mpfr_mul (res, res, res, GMP_RNDU))
+ inexact = 1;
+ if (n & (1UL << i))
+ if (mpfr_mul (res, res, y, rnd1))
+ inexact = 1;
+ }
+ /* FIXME: infinity and 0 should be checked too. */
+ MPFR_ASSERTN (MPFR_IS_FP (res));
+ MPFR_ASSERTN (MPFR_NOTZERO (res));
/* check underflow */
- if (MPFR_EXP(res) <= (double) __gmpfr_emin)
+ if (MPFR_GET_EXP (res) <= __gmpfr_emin)
{
mpfr_clear (res);
mpfr_restore_emin_emax ();
return mpfr_set_underflow (x, rnd, (n % 2) ? MPFR_SIGN(y) : 1);
}
-
- err = prec - err;
- if (err < 0)
- err = 0;
}
while (inexact && !mpfr_can_round (res, err, GMP_RNDN, GMP_RNDZ,
MPFR_PREC(x) + (rnd == GMP_RNDN)));
diff --git a/rint.c b/rint.c
index fcc0c88b2..2c2fa461f 100644
--- a/rint.c
+++ b/rint.c
@@ -24,10 +24,16 @@ MA 02111-1307, USA. */
#include "mpfr.h"
#include "mpfr-impl.h"
+/* This may be a standard rounding mode in the future. */
+#define NEAREST_AWAY ((mp_rnd_t) -1)
+
+/* Merge the following mpfr_rint code with mpfr_round_raw_generic? */
+
int
mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
{
int sign;
+ int rnd_away;
mp_exp_t exp;
if (MPFR_IS_NAN(u))
@@ -56,12 +62,24 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
sign = MPFR_SIGN(u);
exp = MPFR_GET_EXP (u);
- /* Single out the case where |u| < 1. */
- if (exp <= 0) /* 0 < |u| < 1 */
+ rnd_away =
+ rnd_mode == GMP_RNDD ? sign < 0 :
+ rnd_mode == GMP_RNDU ? sign > 0 :
+ rnd_mode == GMP_RNDZ ? 0 : -1;
+
+ /* rnd_away:
+ 1 if round away from zero,
+ 0 if round to zero,
+ -1 if not decided yet.
+ */
+
+ if (exp <= 0) /* 0 < |u| < 1 ==> round |u| to 0 or 1 */
{
- if ((rnd_mode == GMP_RNDD && sign < 0) ||
- (rnd_mode == GMP_RNDU && sign > 0) ||
- (rnd_mode == GMP_RNDN && exp == 0))
+ /* Note: in the GMP_RNDN mode, 0.5 must be rounded to 0. */
+ if (rnd_away != 0 &&
+ (rnd_away > 0 ||
+ (exp == 0 && (rnd_mode == NEAREST_AWAY ||
+ !mpfr_powerof2_raw (u)))))
{
mp_limb_t *rp;
mp_size_t rm;
@@ -106,13 +124,14 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
{
ui = un;
idiff = 0;
- uflags = 0; /* u is an integer */
+ uflags = 0; /* u is an integer, representable or not in r */
}
else
{
mp_size_t uj;
ui = (exp - 1) / BITS_PER_MP_LIMB + 1; /* #limbs of the int part */
+ MPFR_ASSERTN (un >= ui);
uj = un - ui; /* lowest limb of the integer part */
idiff = exp % BITS_PER_MP_LIMB; /* #int-part bits in up[uj] or 0 */
@@ -128,16 +147,49 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
if (ui > rn)
{
+ /* More limbs in the integer part of u than in r.
+ Just round u with the precision of r. */
MPFR_ASSERTN(rp != up && un > rn);
MPN_COPY(rp, up + (un - rn), rn);
- /* In the rounding to the nearest mode, if the rounding bit
- is 0, change the rounding mode to GMP_RNDZ. */
- if (rnd_mode == GMP_RNDN &&
- ((sh != 0 && (rp[0] & (MP_LIMB_T_ONE << (sh - 1))) == 0) ||
- (sh == 0 && (up[un - rn - 1] & MPFR_LIMB_HIGHBIT) == 0)))
- rnd_mode = GMP_RNDZ;
+ if (rnd_away < 0)
+ {
+ /* This is a rounding to nearest mode.
+ Decide the rounding direction here. */
+ if (rnd_mode == GMP_RNDN &&
+ (rp[0] & (MP_LIMB_T_ONE << sh)) == 0)
+ { /* halfway cases rounded towards zero */
+ mp_limb_t a, b;
+ /* a: rounding bit and some of the following bits */
+ /* b: boundary for a (weight of the rounding bit in a) */
+ if (sh != 0)
+ {
+ a = rp[0] & ((MP_LIMB_T_ONE << sh) - 1);
+ b = MP_LIMB_T_ONE << (sh - 1);
+ }
+ else
+ {
+ a = up[un - rn - 1];
+ b = MPFR_LIMB_HIGHBIT;
+ }
+ rnd_away = a > b;
+ if (a == b)
+ {
+ mp_size_t i;
+ for (i = un - rn - 1 - (sh == 0); i >= 0; i--)
+ if (up[i] != 0)
+ {
+ rnd_away = 1;
+ break;
+ }
+ }
+ }
+ else /* halfway cases rounded away from zero */
+ rnd_away = /* rounding bit */
+ ((sh != 0 && (rp[0] & (MP_LIMB_T_ONE << (sh - 1))) != 0) ||
+ (sh == 0 && (up[un - rn - 1] & MPFR_LIMB_HIGHBIT) != 0));
+ }
if (uflags == 0)
- { /* u is an integer; determine if it is representable */
+ { /* u is an integer; determine if it is representable in r */
if (sh != 0 && rp[0] << (BITS_PER_MP_LIMB - sh) != 0)
uflags = 1; /* u is not representable in r */
else
@@ -151,10 +203,8 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
}
}
}
- if (sh != 0)
- rp[0] &= MP_LIMB_T_MAX << sh;
}
- else
+ else /* ui <= rn */
{
mp_size_t uj, rj;
int ush;
@@ -167,50 +217,77 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
if (rp != up)
MPN_COPY(rp + rj, up + uj, ui);
+ /* Ignore the lowest rj limbs, all equal to zero. */
rp += rj;
rn = ui;
+ /* number of fractional bits in whole rp[0] */
ush = idiff == 0 ? 0 : BITS_PER_MP_LIMB - idiff;
+
if (rj == 0 && ush < sh)
{
- /* In the rounding to the nearest mode, if the rounding bit
- is 0, change the rounding mode to GMP_RNDZ. */
- if (rnd_mode == GMP_RNDN &&
- (rp[0] & (MP_LIMB_T_ONE << (sh - 1))) == 0)
- rnd_mode = GMP_RNDZ; /* rounding bit is 0 */
- if (uflags == 0)
- { /* u is an integer; determine if it is representable */
- mp_limb_t mask;
- mask = (MP_LIMB_T_ONE << sh) - (MP_LIMB_T_ONE << ush);
- if ((rp[0] & mask) != 0)
- uflags = 1; /* u is not representable in r */
- }
+ /* If u is an integer (uflags == 0), we need to determine
+ if it is representable in r, i.e. if its sh - ush bits
+ in the non-significant part of r are all 0. */
+ if (uflags == 0 && (rp[0] & ((MP_LIMB_T_ONE << sh) -
+ (MP_LIMB_T_ONE << ush))) != 0)
+ uflags = 1; /* u is an integer not representable in r */
}
- else
+ else /* The integer part of u fits in r, we'll round to it. */
+ sh = ush;
+
+ if (rnd_away < 0)
{
- sh = ush;
- if (rnd_mode == GMP_RNDN &&
- ((ush != 0 &&
- (up[uj] & (MP_LIMB_T_ONE << (ush - 1))) == 0) ||
- (ush == 0 &&
- (uj == 0 || (up[uj - 1] & MPFR_LIMB_HIGHBIT) == 0))))
- rnd_mode = GMP_RNDZ; /* rounding bit is 0 */
+ /* This is a rounding to nearest mode.
+ Decide the rounding direction here. */
+ if (uj == 0 && sh == 0)
+ rnd_away = 0; /* rounding bit = 0 (not represented in u) */
+ else if (rnd_mode == GMP_RNDN &&
+ (rp[0] & (MP_LIMB_T_ONE << sh)) == 0)
+ { /* halfway cases rounded towards zero */
+ mp_limb_t a, b;
+ /* a: rounding bit and some of the following bits */
+ /* b: boundary for a (weight of the rounding bit in a) */
+ if (sh != 0)
+ {
+ a = rp[0] & ((MP_LIMB_T_ONE << sh) - 1);
+ b = MP_LIMB_T_ONE << (sh - 1);
+ }
+ else
+ {
+ MPFR_ASSERTN (uj >= 1); /* see above */
+ a = up[uj - 1];
+ b = MPFR_LIMB_HIGHBIT;
+ }
+ rnd_away = a > b;
+ if (a == b)
+ {
+ mp_size_t i;
+ for (i = uj - 1 - (sh == 0); i >= 0; i--)
+ if (up[i] != 0)
+ {
+ rnd_away = 1;
+ break;
+ }
+ }
+ }
+ else /* halfway cases rounded away from zero */
+ rnd_away = /* rounding bit */
+ ((sh != 0 && (rp[0] & (MP_LIMB_T_ONE << (sh - 1))) != 0) ||
+ (sh == 0 && (MPFR_ASSERTN (uj >= 1),
+ up[uj - 1] & MPFR_LIMB_HIGHBIT) != 0));
}
- if (sh != 0)
- rp[0] &= MP_LIMB_T_MAX << sh;
}
+ if (sh != 0)
+ rp[0] &= MP_LIMB_T_MAX << sh;
+
+ /* If u is a representable integer, there is no rounding. */
if (uflags == 0)
MPFR_RET(0);
- /* Note: if rnd_mode == GMP_RNDN, then round away from 0 (if
- the rounding bit was 0 and rnd_mode == GMP_RNDN, rnd_mode
- has been changed to GMP_RNDZ). */
-
- if ((rnd_mode == GMP_RNDN ||
- (rnd_mode == GMP_RNDD && sign < 0) ||
- (rnd_mode == GMP_RNDU && sign > 0))
- && mpn_add_1(rp, rp, rn, MP_LIMB_T_ONE << sh))
+ MPFR_ASSERTN (rnd_away >= 0); /* rounding direction is defined */
+ if (rnd_away && mpn_add_1(rp, rp, rn, MP_LIMB_T_ONE << sh))
{
if (exp == __gmpfr_emax)
return mpfr_set_overflow(r, rnd_mode, MPFR_SIGN(r)) >= 0 ?
@@ -222,9 +299,7 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
}
}
- MPFR_RET(rnd_mode == GMP_RNDU ||
- (rnd_mode == GMP_RNDZ && sign < 0) ||
- (rnd_mode == GMP_RNDN && sign > 0) ? uflags : -uflags);
+ MPFR_RET (rnd_away ^ (sign < 0) ? uflags : -uflags);
} /* exp > 0, |u| >= 1 */
}
@@ -233,7 +308,7 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mp_rnd_t rnd_mode)
int
mpfr_round (mpfr_ptr r, mpfr_srcptr u)
{
- return mpfr_rint(r, u, GMP_RNDN);
+ return mpfr_rint(r, u, NEAREST_AWAY);
}
#undef mpfr_trunc
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/tacosh.c b/tests/tacosh.c
index fec59cf5c..37e9ef5ee 100644
--- a/tests/tacosh.c
+++ b/tests/tacosh.c
@@ -32,17 +32,39 @@ MA 02111-1307, USA. */
#define RAND_FUNCTION(x) (mpfr_random (x), mpfr_ui_div (x, 1, x, GMP_RNDN))
#include "tgeneric.c"
+static
+void check_inf(void)
+{
+ mpfr_t x,y;
+ mpfr_init(x);
+ mpfr_init(y);
+ MPFR_SET_INF(x);
+ mpfr_set_ui(y, 1, GMP_RNDN);
+ mpfr_acosh(x, y, GMP_RNDN);
+ if (MPFR_IS_INF(x) || MPFR_IS_NAN(x) )
+ {
+ printf("Inf flag not clears in acosh!\n");
+ exit(1);
+ }
+ MPFR_SET_NAN(x);
+ mpfr_acosh(x, y, GMP_RNDN);
+ if (MPFR_IS_NAN(x) || MPFR_IS_INF(x) )
+ {
+ printf("NAN flag not clears in acosh!\n");
+ exit(1);
+ }
+ mpfr_clear (x);
+ mpfr_clear (y);
+}
+
int
main (int argc, char *argv[])
{
tests_start_mpfr ();
test_generic (2, 100, 25);
+ check_inf ();
tests_end_mpfr ();
return 0;
}
-
-
-
-
diff --git a/tests/tasin.c b/tests/tasin.c
index 2aef35121..bba0c5221 100644
--- a/tests/tasin.c
+++ b/tests/tasin.c
@@ -23,7 +23,9 @@ MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
#include "gmp.h"
+#include "gmp-impl.h"
#include "mpfr.h"
+#include "mpfr-impl.h"
#include "mpfr-test.h"
#define TEST_FUNCTION mpfr_asin
diff --git a/tests/terf.c b/tests/terf.c
index a159864ec..64c1cca72 100644
--- a/tests/terf.c
+++ b/tests/terf.c
@@ -36,6 +36,7 @@ int
main (int argc, char *argv[])
{
mpfr_t x, y;
+ int inex;
tests_start_mpfr ();
@@ -159,6 +160,44 @@ main (int argc, char *argv[])
exit (1);
}
+ mpfr_set_prec (x, 8);
+ mpfr_set_prec (y, 8);
+ mpfr_set_ui (x, 50, GMP_RNDN);
+ inex = mpfr_erf (y, x, GMP_RNDN);
+ if (mpfr_cmp_ui (y, 1))
+ {
+ printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN\n");
+ printf ("expected 1, got ");
+ mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (inex <= 0)
+ {
+ printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN: wrong ternary value\n"
+ "expected positive, got %d\n", inex);
+ exit (1);
+ }
+ inex = mpfr_erf (x, x, GMP_RNDZ);
+ mpfr_nextbelow (y);
+ if (mpfr_cmp (x, y))
+ {
+ printf ("mpfr_erf failed for x=50, rnd=GMP_RNDZ\n");
+ printf ("expected ");
+ mpfr_out_str (stdout, 2, 0, y, GMP_RNDN);
+ printf ("\n");
+ printf ("got ");
+ mpfr_out_str (stdout, 2, 0, x, GMP_RNDN);
+ printf ("\n");
+ exit (1);
+ }
+ if (inex >= 0)
+ {
+ printf ("mpfr_erf failed for x=50, rnd=GMP_RNDN: wrong ternary value\n"
+ "expected negative, got %d\n", inex);
+ exit (1);
+ }
+
mpfr_clear (x);
mpfr_clear (y);
diff --git a/tests/tests.c b/tests/tests.c
index 4b26d1ef2..6aabacee5 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -93,7 +93,10 @@ tests_rand_start (void)
printf ("ie. ensure that function is called before the first use of RANDS.\n");
abort ();
}
- rands = RANDS;
+
+ gmp_randinit_default (__gmp_rands);
+ __gmp_rands_initialized = 1;
+ rands = __gmp_rands;
perform_seed = getenv ("GMP_CHECK_RANDOMIZE");
if (perform_seed != NULL)
diff --git a/tests/tgamma.c b/tests/tgamma.c
index c3179e32b..b19621583 100644
--- a/tests/tgamma.c
+++ b/tests/tgamma.c
@@ -22,7 +22,9 @@ MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
#include "gmp.h"
+#include "gmp-impl.h"
#include "mpfr.h"
+#include "mpfr-impl.h"
#include "mpfr-test.h"
int mpfr_gamma (mpfr_ptr, mpfr_srcptr, mp_rnd_t);
diff --git a/tests/thyperbolic.c b/tests/thyperbolic.c
index 6c1923f99..29ea98d28 100644
--- a/tests/thyperbolic.c
+++ b/tests/thyperbolic.c
@@ -1,23 +1,23 @@
/* Test file for hyperbolic function : mpfr_cosh, mpfr_sinh, mpfr_tanh, mpfr_acosh, mpfr_asinh, mpfr_atanh.
-
+
Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-
+
This file is part of the MPFR Library.
-
+
The MPFR Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by
the Free Software Foundation; either version 2.1 of the License, or (at youroption) any later version.
-
+
The MPFR Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITYor FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
-
+
You should have received a copy of the GNU Lesser General Public License
along with the MPFR Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-
+
#include <stdio.h>
#include "gmp.h"
#include "gmp-impl.h"
@@ -30,6 +30,7 @@ check_NAN (void)
{
mpfr_t t, ch,sh,th,ach,ash,ath;
int tester;
+ int fail = 0;
mpfr_init2(t,200);
mpfr_init2(ch,200);
@@ -47,14 +48,8 @@ check_NAN (void)
if (!MPFR_IS_NAN(ch) || tester!=0)
{
printf("cosh NAN \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******sinh********/
@@ -63,14 +58,8 @@ check_NAN (void)
if (!MPFR_IS_NAN(sh) || tester!=0)
{
printf("sinh NAN \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******tanh********/
@@ -79,14 +68,8 @@ check_NAN (void)
if (!MPFR_IS_NAN(th) || tester!=0)
{
printf("tanh NAN \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******acosh********/
@@ -95,7 +78,8 @@ check_NAN (void)
if (!MPFR_IS_NAN(ach) || tester!=0)
{
printf("acosh NAN \n");
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******asinh********/
@@ -104,14 +88,8 @@ check_NAN (void)
if (!MPFR_IS_NAN(ash) || tester!=0)
{
printf("asinh NAN \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******atanh********/
@@ -120,16 +98,11 @@ check_NAN (void)
if (!MPFR_IS_NAN(ath) || tester!=0)
{
printf("atanh NAN \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
+ clean_up:
mpfr_clear(t);
mpfr_clear(ch);
mpfr_clear(sh);
@@ -138,7 +111,7 @@ check_NAN (void)
mpfr_clear(ash);
mpfr_clear(ath);
- return(0);
+ return fail;
}
static int
@@ -146,6 +119,7 @@ check_zero (void)
{
mpfr_t t, ch,sh,th,ach,ash,ath;
int tester;
+ int fail = 0;
mpfr_init2(t,200);
mpfr_init2(ch,200);
@@ -163,14 +137,8 @@ check_zero (void)
if (mpfr_cmp_ui(ch, 1) || tester)
{
printf("cosh(0) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******sinh********/
@@ -179,14 +147,8 @@ check_zero (void)
if (!MPFR_IS_ZERO(sh) || tester)
{
printf("sinh(0) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******tanh********/
@@ -195,14 +157,8 @@ check_zero (void)
if (!MPFR_IS_ZERO(th) || tester)
{
printf("tanh(0) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******acosh********/
@@ -211,14 +167,8 @@ check_zero (void)
if (!MPFR_IS_NAN(ach) || tester)
{
printf("acosh(0) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******asinh********/
@@ -227,14 +177,8 @@ check_zero (void)
if (!MPFR_IS_ZERO(ash) || tester)
{
printf("asinh(0) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******atanh********/
@@ -243,16 +187,11 @@ check_zero (void)
if (!MPFR_IS_ZERO(ath) || tester)
{
printf("atanh(0) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
+ clean_up:
mpfr_clear(t);
mpfr_clear(ch);
mpfr_clear(sh);
@@ -261,7 +200,7 @@ check_zero (void)
mpfr_clear(ash);
mpfr_clear(ath);
- return(0);
+ return fail;
}
static int
@@ -269,6 +208,7 @@ check_INF (void)
{
mpfr_t t, ch,sh,th,ach,ash,ath;
int tester;
+ int fail = 0;
mpfr_init2(t,200);
mpfr_init2(ch,200);
@@ -290,14 +230,8 @@ check_INF (void)
if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0)
{
printf("cosh(INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******sinh********/
@@ -306,14 +240,8 @@ check_INF (void)
if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) < 0 || tester!=0)
{
printf("sinh(INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******tanh********/
@@ -322,14 +250,8 @@ check_INF (void)
if (mpfr_cmp_ui(th,1) != 0 || tester!=0)
{
printf("tanh(INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******acosh********/
@@ -338,14 +260,8 @@ check_INF (void)
if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0)
{
printf("acosh(INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******asinh********/
@@ -354,30 +270,18 @@ check_INF (void)
if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) < 0 || tester!=0)
{
printf("asinh(INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******atanh********/
- tester=mpfr_atanh(ath,t,GMP_RNDD);
+ tester=mpfr_atanh(ath,t,GMP_RNDD);
if (!MPFR_IS_INF(ath) || tester != 0)
{
printf("atanh(INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
MPFR_CHANGE_SIGN(t);
@@ -388,14 +292,8 @@ check_INF (void)
if (!MPFR_IS_INF(ch) || MPFR_SIGN(ch) < 0 || tester!=0)
{
printf("cosh(-INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******sinh********/
@@ -404,14 +302,8 @@ check_INF (void)
if (!MPFR_IS_INF(sh) || MPFR_SIGN(sh) > 0 || tester!=0)
{
printf("sinh(-INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******tanh********/
@@ -420,30 +312,18 @@ check_INF (void)
if (!mpfr_cmp_ui(th,-1) || tester!=0)
{
printf("tanh(-INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******acosh********/
tester=mpfr_acosh(ach,t,GMP_RNDD);
- if (!MPFR_IS_INF(ach) || MPFR_SIGN(ach) < 0 || tester!=0)
+ if (!MPFR_IS_NAN(ach) || tester!=0)
{
printf("acosh(-INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******asinh********/
@@ -452,14 +332,8 @@ check_INF (void)
if (!MPFR_IS_INF(ash) || MPFR_SIGN(ash) > 0 || tester!=0)
{
printf("asinh(-INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
/******atanh********/
@@ -468,16 +342,11 @@ check_INF (void)
if (!MPFR_IS_INF(ath) || MPFR_SIGN(ath) > 0 || tester != 0)
{
printf("atanh(-INF) \n");
- mpfr_clear(t);
- mpfr_clear(ch);
- mpfr_clear(sh);
- mpfr_clear(th);
- mpfr_clear(ach);
- mpfr_clear(ash);
- mpfr_clear(ath);
- return(1);
+ fail = 1;
+ goto clean_up;
}
+ clean_up:
mpfr_clear(t);
mpfr_clear(ch);
mpfr_clear(sh);
@@ -486,7 +355,7 @@ check_INF (void)
mpfr_clear(ash);
mpfr_clear(ath);
- return(0);
+ return fail;
}
int
@@ -494,15 +363,24 @@ main(void)
{
tests_start_mpfr ();
- if (check_zero())
- printf("Error in evaluation at 0\n");
+ if (check_zero ())
+ {
+ printf ("Error in evaluation at 0\n");
+ exit (1);
+ }
- if (check_INF())
- printf("Error in evaluation of INF\n");
+ if (check_INF ())
+ {
+ printf ("Error in evaluation of INF\n");
+ exit (1);
+ }
- if (check_NAN())
- printf("Error in evaluation of NAN\n");
+ if (check_NAN ())
+ {
+ printf ("Error in evaluation of NAN\n");
+ exit (1);
+ }
tests_end_mpfr ();
- return(0);
+ return 0;
}
diff --git a/tests/tpow.c b/tests/tpow.c
index fa183e77e..c21e4376c 100644
--- a/tests/tpow.c
+++ b/tests/tpow.c
@@ -142,6 +142,22 @@ special ()
mpfr_init2 (z, 53);
mpfr_init2 (t, 2);
+ mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_pow_si (x, x, -2, GMP_RNDN);
+ if (mpfr_cmp_ui_2exp (x, 1, -2))
+ {
+ printf ("Error in pow_si(x,x,-2) for x=2\n");
+ exit (1);
+ }
+ mpfr_set_ui (x, 2, GMP_RNDN);
+ mpfr_set_si (y, -2, GMP_RNDN);
+ mpfr_pow (x, x, y, GMP_RNDN);
+ if (mpfr_cmp_ui_2exp (x, 1, -2))
+ {
+ printf ("Error in pow(x,x,y) for x=2, y=-2\n");
+ exit (1);
+ }
+
mpfr_set_prec (x, 64);
mpfr_set_prec (y, 64);
mpfr_set_prec (z, 64);
diff --git a/tests/trint.c b/tests/trint.c
index e8a47cefa..b02b42221 100644
--- a/tests/trint.c
+++ b/tests/trint.c
@@ -1,4 +1,4 @@
-/* Test file for mpfr_trunc, mpfr_floor, mpfr_ceil, mpfr_round.
+/* Test file for mpfr_rint, mpfr_trunc, mpfr_floor, mpfr_ceil, mpfr_round.
Copyright 2002, 2003 Free Software Foundation.
@@ -21,17 +21,84 @@ MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "gmp.h"
+#include "gmp-impl.h"
#include "mpfr.h"
+#include "mpfr-impl.h"
#include "mpfr-test.h"
+#if __STDC_VERSION__ >= 199901L
+
+static void
+test_fct (double (*f)(double), int (*g)(), char *s, mp_rnd_t r)
+{
+ double d, y;
+ mpfr_t dd, yy;
+
+ mpfr_init2 (dd, 53);
+ mpfr_init2 (yy, 53);
+ for (d = -5.0; d <= 5.0; d += 0.25)
+ {
+ mpfr_set_d (dd, d, r);
+ y = (*f)(d);
+ if (g == &mpfr_rint)
+ mpfr_rint (yy, dd, r);
+ else
+ (*g)(yy, dd);
+ mpfr_set_d (dd, y, r);
+ if (mpfr_cmp (yy, dd))
+ {
+ printf ("test_against_libc: incorrect result for %s, rnd = %s,"
+ " d = %g\ngot ", s, mpfr_print_rnd_mode (r), d);
+ mpfr_out_str (stdout, 10, 0, yy, GMP_RNDN);
+ printf (" instead of %g\n", y);
+ exit (1);
+ }
+ }
+ mpfr_clear (dd);
+ mpfr_clear (yy);
+}
+
+#define TEST_FCT(F) test_fct (&F, &mpfr_##F, #F, r)
+
+static void
+test_against_libc (void)
+{
+ int r = 0;
+
+ TEST_FCT (round);
+ TEST_FCT (trunc);
+ TEST_FCT (floor);
+ TEST_FCT (ceil);
+ for (r = 0; r < 4; r++)
+ if (mpfr_set_machine_rnd_mode (r) == 0)
+ test_fct (&nearbyint, &mpfr_rint, "rint", r);
+}
+
+#endif
+
+static void
+err (char *str, mp_size_t s, mpfr_t x, mpfr_t y, mp_prec_t p, mp_rnd_t r,
+ int trint, int inexact)
+{
+ printf ("Error: %s\ns = %u, p = %u, r = %s, trint = %d, inexact = %d\nx = ",
+ str, (unsigned int) s, (unsigned int) p, mpfr_print_rnd_mode (r),
+ trint, inexact);
+ mpfr_print_binary (x);
+ printf ("\ny = ");
+ mpfr_print_binary (y);
+ printf ("\n");
+ exit (1);
+}
+
int
-main (void)
+main (int argc, char *argv[])
{
mp_size_t s;
mpz_t z;
mp_prec_t p;
- mpfr_t x, y, t;
+ mpfr_t x, y, t, u, v;
mp_rnd_t r;
int inexact, sign_t;
@@ -41,6 +108,8 @@ main (void)
mpfr_init (y);
mpz_init (z);
mpfr_init (t);
+ mpfr_init (u);
+ mpfr_init (v);
mpz_set_ui (z, 1);
for (s = 2; s < 100; s++)
{
@@ -51,45 +120,125 @@ main (void)
mpz_add_ui (z, z, 1);
mpfr_set_prec (x, s);
mpfr_set_prec (t, s);
+ mpfr_set_prec (u, s);
if (mpfr_set_z (x, z, GMP_RNDN))
{
printf ("Error: mpfr_set_z should be exact (s = %u)\n",
(unsigned int) s);
exit (1);
}
- for (p=2; p<100; p++)
+ if (randlimb () % 2)
+ mpfr_neg (x, x, GMP_RNDN);
+ if (randlimb () % 2)
+ mpfr_div_2ui (x, x, randlimb () % s, GMP_RNDN);
+ for (p = 2; p < 100; p++)
{
+ int trint;
mpfr_set_prec (y, p);
- for (r=0; r<4; r++)
- {
- if (r == GMP_RNDN)
- inexact = mpfr_round (y, x);
- else if (r == GMP_RNDZ)
- inexact = mpfr_trunc (y, x);
- else if (r == GMP_RNDU)
- inexact = mpfr_ceil (y, x);
- else /* r = GMP_RNDD */
- inexact = mpfr_floor (y, x);
- if (mpfr_sub (t, y, x, GMP_RNDN))
- {
- printf ("Error: subtraction should be exact\n");
- exit (1);
- }
- sign_t = mpfr_cmp_ui (t, 0);
- if (((inexact == 0) && (sign_t != 0)) ||
- ((inexact < 0) && (sign_t >= 0)) ||
- ((inexact > 0) && (sign_t <= 0)))
- {
- printf ("Wrong inexact flag\n");
- exit (1);
- }
- }
+ mpfr_set_prec (v, p);
+ for (r = 0; r < 4; r++)
+ for (trint = 0; trint < 2; trint++)
+ {
+ if (trint)
+ inexact = mpfr_rint (y, x, r);
+ else if (r == GMP_RNDN)
+ inexact = mpfr_round (y, x);
+ else if (r == GMP_RNDZ)
+ inexact = mpfr_trunc (y, x);
+ else if (r == GMP_RNDU)
+ inexact = mpfr_ceil (y, x);
+ else /* r = GMP_RNDD */
+ inexact = mpfr_floor (y, x);
+ if (mpfr_sub (t, y, x, GMP_RNDN))
+ err ("subtraction 1 should be exact",
+ s, x, y, p, r, trint, inexact);
+ sign_t = mpfr_cmp_ui (t, 0);
+ if (((inexact == 0) && (sign_t != 0)) ||
+ ((inexact < 0) && (sign_t >= 0)) ||
+ ((inexact > 0) && (sign_t <= 0)))
+ err ("wrong inexact flag", s, x, y, p, r, trint, inexact);
+ if (inexact == 0)
+ continue; /* end of the test for exact results */
+
+ if (((r == GMP_RNDD || (r == GMP_RNDZ && MPFR_SIGN (x) > 0))
+ && inexact > 0) ||
+ ((r == GMP_RNDU || (r == GMP_RNDZ && MPFR_SIGN (x) < 0))
+ && inexact < 0))
+ err ("wrong rounding direction",
+ s, x, y, p, r, trint, inexact);
+ if (inexact < 0)
+ {
+ mpfr_add_ui (v, y, 1, GMP_RNDU);
+ if (mpfr_cmp (v, x) <= 0)
+ err ("representable integer between x and its "
+ "rounded value", s, x, y, p, r, trint, inexact);
+ }
+ else
+ {
+ mpfr_sub_ui (v, y, 1, GMP_RNDD);
+ if (mpfr_cmp (v, x) >= 0)
+ err ("representable integer between x and its "
+ "rounded value", s, x, y, p, r, trint, inexact);
+ }
+ if (r == GMP_RNDN)
+ {
+ int cmp;
+ if (mpfr_sub (u, v, x, GMP_RNDN))
+ err ("subtraction 2 should be exact",
+ s, x, y, p, r, trint, inexact);
+ cmp = mpfr_cmp_abs (t, u);
+ if (cmp > 0)
+ err ("faithful rounding, but not the nearest integer",
+ s, x, y, p, r, trint, inexact);
+ if (cmp < 0)
+ continue;
+ /* |t| = |u|: x is the middle of two consecutive
+ representable integers. */
+ if (trint)
+ {
+ /* halfway case for mpfr_rint in GMP_RNDN rounding
+ mode: round to an even integer or mantissa. */
+ mpfr_div_2ui (y, y, 1, GMP_RNDZ);
+ if (!mpfr_integer_p (y))
+ err ("halfway case for mpfr_rint, result isn't an"
+ " even integer", s, x, y, p, r, trint, inexact);
+ /* If floor(x) and ceil(x) aren't both representable
+ integers, the mantissa must be even. */
+ mpfr_sub (v, v, y, GMP_RNDN);
+ mpfr_abs (v, v, GMP_RNDN);
+ if (mpfr_cmp_ui (v, 1) != 0)
+ {
+ mpfr_div_2si (y, y, MPFR_EXP (y) - MPFR_PREC (y)
+ + 1, GMP_RNDN);
+ if (!mpfr_integer_p (y))
+ err ("halfway case for mpfr_rint, mantissa isn't"
+ " even", s, x, y, p, r, trint, inexact);
+ }
+ }
+ else
+ { /* halfway case for mpfr_round: x must have been
+ rounded away from zero. */
+ if ((MPFR_SIGN (x) > 0 && inexact < 0) ||
+ (MPFR_SIGN (x) < 0 && inexact > 0))
+ err ("halfway case for mpfr_round, bad rounding"
+ " direction", s, x, y, p, r, trint, inexact);
+ }
+ }
+ }
}
}
mpfr_clear (x);
mpfr_clear (y);
mpz_clear (z);
mpfr_clear (t);
+ mpfr_clear (u);
+ mpfr_clear (v);
+
+ /* TODO: add hardcoded tests */
+#if __STDC_VERSION__ >= 199901L
+ if (argc > 1 && strcmp (argv[1], "-s") == 0)
+ test_against_libc ();
+#endif
tests_end_mpfr ();
return 0;
diff --git a/tests/tset_ld.c b/tests/tset_ld.c
index 0aed61892..7cb6a461e 100644
--- a/tests/tset_ld.c
+++ b/tests/tset_ld.c
@@ -29,6 +29,20 @@ MA 02111-1307, USA. */
#include "mpfr-impl.h"
#include "mpfr-test.h"
+static void
+check_gcc33_bug (void)
+{
+ volatile long double x;
+ x = (long double) 9007199254740992.0 + 1.0;
+ if (x != 0.0)
+ return; /* OK */
+ printf
+ ("Detected optimization bug of gcc 3.3 on Alpha concerning long double\n"
+ "comparisons; set_ld tests are disabled (set_ld won't work correctly).\n"
+ "See http://gcc.gnu.org/ml/gcc-bugs/2003-10/msg00853.html for more\n"
+ "information on this bug.\n");
+ exit (0); /* This is not a bug in MPFR, so don't fail. */
+}
static int
Isnan_ld (long double d)
@@ -78,6 +92,8 @@ main (int argc, char *argv[])
mpfr_t x;
int i;
+ check_gcc33_bug ();
+
tests_start_mpfr ();
mpfr_test_init ();
tests_machine_prec_long_double ();
diff --git a/tests/tui_pow.c b/tests/tui_pow.c
index caac437fd..29171527d 100644
--- a/tests/tui_pow.c
+++ b/tests/tui_pow.c
@@ -36,8 +36,22 @@ test1 (void)
mpfr_init2 (x, 32);
mpfr_init2 (y, 65);
+
mpfr_set_str_binary (x, "-0.101110001001011011011e-9");
mpfr_ui_pow (y, 7, x, GMP_RNDN);
+
+ mpfr_set_prec (x, 40);
+ mpfr_set_str_binary (x, "-0.1100101100101111011001010010110011110110E-1");
+ mpfr_set_prec (y, 74);
+ mpfr_ui_pow (y, 8, x, GMP_RNDN);
+ mpfr_set_prec (x, 74);
+ mpfr_set_str_binary (x, "0.11100000010100111101000011111011011010011000011000101011010011010101000011E-1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for input of 40 bits, output of 74 bits\n");
+ exit (1);
+ }
+
mpfr_clear (x);
mpfr_clear (y);
}
@@ -131,7 +145,7 @@ main (int argc, char *argv[])
}
MPFR_CHANGE_SIGN(x);
- mpfr_ui_pow (y, n,x, GMP_RNDN);
+ mpfr_ui_pow (y, n, x, GMP_RNDN);
if(!MPFR_IS_ZERO(y))
{
printf ("evaluation of function in -INF does not return 0");
@@ -139,7 +153,7 @@ main (int argc, char *argv[])
}
MPFR_SET_NAN(x);
- mpfr_ui_pow (y, n,x, GMP_RNDN);
+ mpfr_ui_pow (y, n, x, GMP_RNDN);
if(!MPFR_IS_NAN(y))
{
printf ("evaluation of function in NAN does not return NAN");
@@ -165,6 +179,34 @@ main (int argc, char *argv[])
mpfr_set_str_binary (t, "0.110000E5");
mpfr_ui_pow (z, 3, t, GMP_RNDN);
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_d (x, -0.5, GMP_RNDZ);
+ mpfr_ui_pow (y, 4, x, GMP_RNDD);
+ if (mpfr_get_d1 (y) != 0.5)
+ {
+ fprintf (stderr, "Error for 4^(-0.5), prec=2, GMP_RNDD\n");
+ fprintf (stderr, "expected 0.5, got ");
+ mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
+ fprintf (stderr, "\n");
+ exit (1);
+ }
+
+ /* problem found by Kevin on spe175.testdrive.compaq.com
+ (03 Sep 2003) */
+ mpfr_set_prec (x, 2);
+ mpfr_set_prec (y, 2);
+ mpfr_set_d (x, 0.5, GMP_RNDN);
+ mpfr_ui_pow (y, 398441521, x, GMP_RNDN);
+ if (mpfr_get_d1 (y) != 16384.0)
+ {
+ fprintf (stderr, "Error for 398441521^(0.5), prec=2, GMP_RNDN\n");
+ fprintf (stderr, "expected 1.0e14, got ");
+ mpfr_out_str (stderr, 2, 0, y, GMP_RNDN);
+ fprintf (stderr, "\n");
+ exit (1);
+ }
+
mpfr_clear (z);
mpfr_clear (t);
diff --git a/tests/tzeta.c b/tests/tzeta.c
index 95b6dd38e..73005c92a 100644
--- a/tests/tzeta.c
+++ b/tests/tzeta.c
@@ -35,8 +35,28 @@ test1 (void)
mpfr_init2 (x, 32);
mpfr_init2 (y, 42);
+
mpfr_set_str_binary (x, "1.1111111101000111011010010010100e-1");
mpfr_zeta (y, x, GMP_RNDN); /* shouldn't crash */
+
+ mpfr_set_prec (x, 40);
+ mpfr_set_prec (y, 50);
+ mpfr_set_str_binary (x, "1.001101001101000010011010110100110000101e-1");
+ mpfr_zeta (y, x, GMP_RNDU);
+ mpfr_set_prec (x, 50);
+ mpfr_set_str_binary (x, "-0.11111100011100111111101111100011110111001111111111E1");
+ if (mpfr_cmp (x, y))
+ {
+ printf ("Error for input on 40 bits, output on 50 bits\n");
+ printf ("Expected "); mpfr_print_binary (x); puts ("");
+ printf ("Got "); mpfr_print_binary (y); puts ("");
+ mpfr_set_str_binary (x, "1.001101001101000010011010110100110000101e-1");
+ mpfr_zeta (y, x, GMP_RNDU);
+ mpfr_print_binary (x); puts ("");
+ mpfr_print_binary (y); puts ("");
+ exit (1);
+ }
+
mpfr_clear (x);
mpfr_clear (y);
}