diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-10-26 01:49:26 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-10-26 01:49:26 +0000 |
commit | c095768f11e0d5034a15efdd4c5d9938f9683433 (patch) | |
tree | 1a429d1984c151a0e0c9c1bf80ee68a6b7702f0c | |
parent | 1183042badcf844d47a624f900f53c04292b3372 (diff) | |
download | mpfr-c095768f11e0d5034a15efdd4c5d9938f9683433.tar.gz |
Replaced mpfr_set_emin/emax by set_emin/emax in tests to check
the return value; defined set_emin/emax in "tests/tests.c".
Fix: added missing #include <string.h> in "tests/tests.c".
Removed variable names in prototypes in "mpfr-test.h".
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3058 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | mpfr-test.h | 9 | ||||
-rw-r--r-- | tests/tacos.c | 8 | ||||
-rw-r--r-- | tests/tadd1sp.c | 4 | ||||
-rw-r--r-- | tests/tasin.c | 8 | ||||
-rw-r--r-- | tests/tatan.c | 8 | ||||
-rw-r--r-- | tests/tcos.c | 8 | ||||
-rw-r--r-- | tests/tcosh.c | 8 | ||||
-rw-r--r-- | tests/tdiv.c | 8 | ||||
-rw-r--r-- | tests/tests.c | 21 | ||||
-rw-r--r-- | tests/texceptions.c | 8 | ||||
-rw-r--r-- | tests/texp.c | 16 | ||||
-rw-r--r-- | tests/texp2.c | 16 | ||||
-rw-r--r-- | tests/tgamma.c | 8 | ||||
-rw-r--r-- | tests/tlog.c | 8 | ||||
-rw-r--r-- | tests/tmul.c | 8 | ||||
-rw-r--r-- | tests/tmul_ui.c | 4 | ||||
-rw-r--r-- | tests/trandom.c | 4 | ||||
-rw-r--r-- | tests/trint.c | 4 | ||||
-rw-r--r-- | tests/tround_prec.c | 4 | ||||
-rw-r--r-- | tests/tset.c | 4 | ||||
-rw-r--r-- | tests/tset_exp.c | 4 | ||||
-rw-r--r-- | tests/tset_ld.c | 4 | ||||
-rw-r--r-- | tests/tset_si.c | 14 | ||||
-rw-r--r-- | tests/tset_str.c | 8 | ||||
-rw-r--r-- | tests/tset_z.c | 12 | ||||
-rw-r--r-- | tests/tsub1sp.c | 4 | ||||
-rw-r--r-- | tests/ttanh.c | 8 |
27 files changed, 120 insertions, 100 deletions
diff --git a/mpfr-test.h b/mpfr-test.h index 28968219b..1b592bf44 100644 --- a/mpfr-test.h +++ b/mpfr-test.h @@ -66,7 +66,7 @@ void tests_machine_prec_double _MPFR_PROTO ((void)); void tests_machine_prec_long_double _MPFR_PROTO ((void)); unsigned short x86_fstcw _MPFR_PROTO ((void)); -void x86_fldcw _MPFR_PROTO ((unsigned short cw)); +void x86_fldcw _MPFR_PROTO ((unsigned short)); int mpfr_set_machine_rnd_mode _MPFR_PROTO ((mp_rnd_t)); void mpfr_test_init _MPFR_PROTO ((void)); @@ -79,10 +79,11 @@ int Isnan _MPFR_PROTO ((double)); void d_trace _MPFR_PROTO ((const char *, double)); void ld_trace _MPFR_PROTO ((const char *, long double)); -FILE *src_fopen _MPFR_PROTO ((const char *filename, const char *mode)); +FILE *src_fopen _MPFR_PROTO ((const char *, const char *)); +void set_emin _MPFR_PROTO ((mp_exp_t)); +void set_emax _MPFR_PROTO ((mp_exp_t)); -int mpfr_cmp_str _MPFR_PROTO ((mpfr_srcptr x, const char *s, int base, - mp_rnd_t rnd)); +int mpfr_cmp_str _MPFR_PROTO ((mpfr_srcptr x, const char *, int, mp_rnd_t)); #define mpfr_cmp_str1(x,s) mpfr_cmp_str(x,s,10,GMP_RNDN) #define mpfr_set_str1(x,s) mpfr_set_str(x,s,10,GMP_RNDN) diff --git a/tests/tacos.c b/tests/tacos.c index e1df1cb9b..cf045fc2e 100644 --- a/tests/tacos.c +++ b/tests/tacos.c @@ -75,8 +75,8 @@ special_overflow (void) { mpfr_t x, y; - mpfr_set_emin (-125); - mpfr_set_emax (128); + set_emin (-125); + set_emax (128); mpfr_init2 (x, 24); mpfr_init2 (y, 48); mpfr_set_str_binary (x, "0.101100100000000000110100E0"); @@ -90,8 +90,8 @@ special_overflow (void) } mpfr_clear (y); mpfr_clear (x); - mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_emax (MPFR_EMAX_MAX); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); } int diff --git a/tests/tadd1sp.c b/tests/tadd1sp.c index 804e700d3..f7e0aa5ff 100644 --- a/tests/tadd1sp.c +++ b/tests/tadd1sp.c @@ -32,8 +32,8 @@ check_overflow (void) { mpfr_t x, y, z1, z2; - mpfr_set_emin (-1021); - mpfr_set_emax (1024); + set_emin (-1021); + set_emax (1024); mpfr_inits (x, y, z1, z2, NULL); diff --git a/tests/tasin.c b/tests/tasin.c index 12bdaf579..f09ed4235 100644 --- a/tests/tasin.c +++ b/tests/tasin.c @@ -157,8 +157,8 @@ special_overflow (void) { mpfr_t x, y; - mpfr_set_emin (-125); - mpfr_set_emax (128); + set_emin (-125); + set_emax (128); mpfr_init2 (x, 24); mpfr_init2 (y, 48); mpfr_set_str_binary (x, "0.101100100000000000110100E0"); @@ -172,8 +172,8 @@ special_overflow (void) } mpfr_clear (y); mpfr_clear (x); - mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_emax (MPFR_EMAX_MAX); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); } int diff --git a/tests/tatan.c b/tests/tatan.c index f0f146ad7..f3ef4f0e3 100644 --- a/tests/tatan.c +++ b/tests/tatan.c @@ -157,8 +157,8 @@ special_overflow (void) { mpfr_t x, y; - mpfr_set_emin (-125); - mpfr_set_emax (128); + set_emin (-125); + set_emax (128); mpfr_init2 (x, 24); mpfr_init2 (y, 48); mpfr_set_str_binary (x, "0.101101010001001101111010E0"); @@ -172,8 +172,8 @@ special_overflow (void) } mpfr_clear (y); mpfr_clear (x); - mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_emax (MPFR_EMAX_MAX); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); } int diff --git a/tests/tcos.c b/tests/tcos.c index 5c02f6709..1500508ee 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -121,12 +121,12 @@ special_overflow (void) mpfr_init2 (y, 73); /* Check special case: An overflow in const_pi could occurs! */ - mpfr_set_emin (-125); - mpfr_set_emax (128); + set_emin (-125); + set_emax (128); mpfr_set_str_binary (x, "0.111101010110110011101101E6"); mpfr_cos (y, x, GMP_RNDZ); - mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_emax (MPFR_EMAX_MAX); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); mpfr_clear (x); mpfr_clear (y); diff --git a/tests/tcosh.c b/tests/tcosh.c index d48a4ed68..74b138a7b 100644 --- a/tests/tcosh.c +++ b/tests/tcosh.c @@ -110,8 +110,8 @@ special_overflow (void) 3. cosh(x) exp overflow even with the largest range of exp */ mpfr_t x, y; - mpfr_set_emin (-125); - mpfr_set_emax (128); + set_emin (-125); + set_emax (128); mpfr_init2 (x, 24); mpfr_init2 (y, 24); @@ -134,8 +134,8 @@ special_overflow (void) exit (1); } - mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_emax (MPFR_EMAX_MAX); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); mpfr_set_str_binary (x, "0.101100100000000000110100E1000000"); mpfr_cosh (y, x, GMP_RNDN); diff --git a/tests/tdiv.c b/tests/tdiv.c index 4e9457b56..fafa70e9d 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -544,17 +544,17 @@ check_nan (void) /* check overflow */ emax = mpfr_get_emax (); - mpfr_set_emax (1); + set_emax (1); mpfr_set_ui (a, 1, GMP_RNDZ); mpfr_set_ui (d, 1, GMP_RNDZ); mpfr_div_2exp (d, d, 1, GMP_RNDZ); mpfr_div (q, a, d, GMP_RNDU); /* 1 / 0.5 = 2 -> overflow */ MPFR_ASSERTN (mpfr_inf_p (q) && mpfr_sgn (q) > 0); - mpfr_set_emax (emax); + set_emax (emax); /* check underflow */ emin = mpfr_get_emin (); - mpfr_set_emin (-1); + set_emin (-1); mpfr_set_ui (a, 1, GMP_RNDZ); mpfr_div_2exp (a, a, 2, GMP_RNDZ); mpfr_set_ui (d, 2, GMP_RNDZ); @@ -562,7 +562,7 @@ check_nan (void) MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_POS (q)); mpfr_div (q, a, d, GMP_RNDN); /* 0.5*2^(-2) -> underflow */ MPFR_ASSERTN (mpfr_cmp_ui (q, 0) == 0 && MPFR_IS_POS (q)); - mpfr_set_emin (emin); + set_emin (emin); mpfr_clear (a); mpfr_clear (d); diff --git a/tests/tests.c b/tests/tests.c index b61c8892f..63c0e0167 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -27,6 +27,7 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <float.h> #if TIME_WITH_SYS_TIME @@ -295,7 +296,7 @@ FILE *src_fopen (const char *filename, const char *mode) char *buffer; FILE *f; - if (srcdir == NULL) + if (srcdir == NULL) return fopen (filename, mode); buffer = malloc (strlen (filename) + strlen (srcdir) + 1); if (buffer == NULL) @@ -308,3 +309,21 @@ FILE *src_fopen (const char *filename, const char *mode) free (buffer); return f; } + +void set_emin (mp_exp_t exponent) +{ + if (mpfr_set_emin (exponent)) + { + printf ("set_emin: setting emin to %ld failed\n", (long int) exponent); + exit (1); + } +} + +void set_emax (mp_exp_t exponent) +{ + if (mpfr_set_emax (exponent)) + { + printf ("set_emax: setting emax to %ld failed\n", (long int) exponent); + exit (1); + } +} diff --git a/tests/texceptions.c b/tests/texceptions.c index 0d99daaec..1ff15158f 100644 --- a/tests/texceptions.c +++ b/tests/texceptions.c @@ -82,8 +82,8 @@ mpfr_set_double_range (void) (We have to add one for mpfr since mantissa are between 1/2 and 1.) */ - mpfr_set_emin (-1021); - mpfr_set_emax (1024); + set_emin (-1021); + set_emax (1024); } static void @@ -249,7 +249,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_emax (1025); + set_emax (1025); mpfr_set_ui (x, 1, GMP_RNDN); mpfr_mul_2exp (x, x, 1024, GMP_RNDN); mpfr_set_double_range (); @@ -293,7 +293,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_emin (-1026); + set_emin (-1026); mpfr_set_ui (x, 1, GMP_RNDN); mpfr_div_2exp (x, x, 1025, GMP_RNDN); mpfr_set_double_range (); diff --git a/tests/texp.c b/tests/texp.c index d1bba9a51..153b200c5 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -217,7 +217,7 @@ check_special () /* check overflow */ emax = mpfr_get_emax (); - mpfr_set_emax (10); + set_emax (10); mpfr_set_ui (x, 7, GMP_RNDN); mpfr_exp (y, x, GMP_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) @@ -225,11 +225,11 @@ check_special () printf ("Error for exp(7) for emax=10\n"); exit (1); } - mpfr_set_emax (emax); + set_emax (emax); /* check underflow */ emin = mpfr_get_emin (); - mpfr_set_emin (-10); + set_emin (-10); mpfr_set_si (x, -9, GMP_RNDN); mpfr_exp (y, x, GMP_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) @@ -239,7 +239,7 @@ check_special () printf ("Got "); mpfr_print_binary (y); puts (""); exit (1); } - mpfr_set_emin (emin); + set_emin (emin); /* check case EXP(x) < -precy */ mpfr_set_prec (y, 2); @@ -295,8 +295,8 @@ check_special () mpfr_exp_3 (y, x, GMP_RNDN); /* Check some little things about overflow detection */ - mpfr_set_emin (-125); - mpfr_set_emax (128); + set_emin (-125); + set_emax (128); mpfr_set_prec (x, 107); mpfr_set_prec (y, 107); mpfr_set_str_binary (x, "0.11110000000000000000000000000000000000000000000" @@ -312,8 +312,8 @@ check_special () exit (1); } - mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_emax (MPFR_EMAX_MAX); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); /* Check for overflow producing a segfault with HUGE exponent */ mpfr_set_ui (x, 3, GMP_RNDN); diff --git a/tests/texp2.c b/tests/texp2.c index e304f85d6..771346efe 100644 --- a/tests/texp2.c +++ b/tests/texp2.c @@ -33,8 +33,8 @@ special_overflow (void) { mpfr_t x, y; - mpfr_set_emin (-125); - mpfr_set_emax (128); + set_emin (-125); + set_emax (128); mpfr_init2 (x, 24); mpfr_init2 (y, 24); @@ -50,8 +50,8 @@ special_overflow (void) mpfr_clear (y); mpfr_clear (x); - mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_emax (MPFR_EMAX_MAX); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); } int @@ -102,7 +102,7 @@ main (int argc, char *argv[]) mpfr_set_prec (y, 10); /* save emin */ emin = mpfr_get_emin (); - mpfr_set_emin (-10); + set_emin (-10); mpfr_set_si (x, -12, GMP_RNDN); mpfr_exp2 (y, x, GMP_RNDN); if (mpfr_cmp_ui (y, 0) || mpfr_sgn (y) < 0) @@ -113,11 +113,11 @@ main (int argc, char *argv[]) exit (1); } /* restore emin */ - mpfr_set_emin (emin); + set_emin (emin); /* save emax */ emax = mpfr_get_emax (); - mpfr_set_emax (10); + set_emax (10); mpfr_set_ui (x, 11, GMP_RNDN); mpfr_exp2 (y, x, GMP_RNDN); if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0) @@ -126,7 +126,7 @@ main (int argc, char *argv[]) exit (1); } /* restore emax */ - mpfr_set_emax (emax); + set_emax (emax); MPFR_SET_INF(x); diff --git a/tests/tgamma.c b/tests/tgamma.c index 5894bfd06..1d0af89de 100644 --- a/tests/tgamma.c +++ b/tests/tgamma.c @@ -171,8 +171,8 @@ special_overflow (void) { mpfr_t x, y; - mpfr_set_emin (-125); - mpfr_set_emax (128); + set_emin (-125); + set_emax (128); mpfr_init2 (x, 24); mpfr_init2 (y, 24); @@ -187,8 +187,8 @@ special_overflow (void) mpfr_clear (y); mpfr_clear (x); - mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_emax (MPFR_EMAX_MAX); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); } int diff --git a/tests/tlog.c b/tests/tlog.c index 1ad90cf5f..8d839ee00 100644 --- a/tests/tlog.c +++ b/tests/tlog.c @@ -159,14 +159,14 @@ special (void) mpfr_init2 (y, 53); /* Check special case: An overflow in const_pi could occurs! */ - mpfr_set_emin (-125); - mpfr_set_emax (128); + set_emin (-125); + set_emax (128); mpfr_set_prec (y, 24*2); mpfr_set_prec (x, 24); mpfr_set_str_binary (x, "0.111110101010101011110101E0"); mpfr_log (y, x, GMP_RNDN); - mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_emax (MPFR_EMAX_MAX); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); mpfr_set_prec (y, 53); mpfr_set_prec (x, 53); diff --git a/tests/tmul.c b/tests/tmul.c index e825effda..51580b864 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -300,17 +300,17 @@ check_max(void) /* check underflow */ emin = mpfr_get_emin (); - mpfr_set_emin (0); + set_emin (0); mpfr_set_str_binary (xx, "0.1E0"); mpfr_set_str_binary (yy, "0.1E0"); mpfr_mul (zz, xx, yy, GMP_RNDN); /* exact result is 0.1E-1, which should round to 0 */ MPFR_ASSERTN(mpfr_cmp_ui (zz, 0) == 0 && MPFR_IS_POS(zz)); - mpfr_set_emin (emin); + set_emin (emin); /* coverage test for mpfr_powerof2_raw */ emin = mpfr_get_emin (); - mpfr_set_emin (0); + set_emin (0); mpfr_set_prec (xx, mp_bits_per_limb + 1); mpfr_set_str_binary (xx, "0.1E0"); mpfr_nextabove (xx); @@ -318,7 +318,7 @@ check_max(void) mpfr_mul (zz, xx, yy, GMP_RNDN); /* exact result is just above 0.1E-1, which should round to minfloat */ MPFR_ASSERTN(mpfr_cmp (zz, yy) == 0); - mpfr_set_emin (emin); + set_emin (emin); mpfr_clear(xx); mpfr_clear(yy); diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c index 09bfb3490..327e19f3c 100644 --- a/tests/tmul_ui.c +++ b/tests/tmul_ui.c @@ -140,11 +140,11 @@ main (int argc, char *argv[]) MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); emax = mpfr_get_emax (); - mpfr_set_emax (0); + set_emax (0); mpfr_set_str_binary (x, "0.1E0"); mpfr_mul_ui (x, x, 2, GMP_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && MPFR_IS_POS(x)); - mpfr_set_emax (emax); + set_emax (emax); mpfr_set_str (x, /*1.0/3.0*/ "0.333333333333333333333333333333333", 10, GMP_RNDZ); diff --git a/tests/trandom.c b/tests/trandom.c index e5d1ff967..f59bbae4b 100644 --- a/tests/trandom.c +++ b/tests/trandom.c @@ -188,7 +188,7 @@ test_urandomb (long nbtests, mp_prec_t prec, int verbose) /* coverage test */ emin = mpfr_get_emin (); - mpfr_set_emin (1); /* the generated number in [0,1[ is not in the exponent + set_emin (1); /* the generated number in [0,1[ is not in the exponent range, except if it is zero */ k = mpfr_urandomb (x, state); if (MPFR_IS_ZERO(x) == 0 && (k == 0 || mpfr_nan_p (x) == 0)) @@ -197,7 +197,7 @@ test_urandomb (long nbtests, mp_prec_t prec, int verbose) mpfr_dump (x); exit (1); } - mpfr_set_emin (emin); + set_emin (emin); mpfr_clear (x); gmp_randclear (state); diff --git a/tests/trint.c b/tests/trint.c index e2b66939d..3a93bc66e 100644 --- a/tests/trint.c +++ b/tests/trint.c @@ -64,13 +64,13 @@ special (void) /* another coverage test */ emax = mpfr_get_emax (); - mpfr_set_emax (1); + set_emax (1); mpfr_set_prec (x, 3); mpfr_set_str_binary (x, "1.11E0"); mpfr_set_prec (y, 2); mpfr_rint (y, x, GMP_RNDU); /* x rounds to 1.0E1=0.1E2 which overflows */ MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0); - mpfr_set_emax (emax); + set_emax (emax); /* yet another */ mpfr_set_prec (x, 97); diff --git a/tests/tround_prec.c b/tests/tround_prec.c index b7e07c0fa..8073e59b0 100644 --- a/tests/tround_prec.c +++ b/tests/tround_prec.c @@ -56,12 +56,12 @@ main (void) MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_NEG(x)); emax = mpfr_get_emax (); - mpfr_set_emax (0); + set_emax (0); mpfr_set_prec (x, 3); mpfr_set_str_binary (x, "0.111"); mpfr_prec_round (x, 2, GMP_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); - mpfr_set_emax (emax); + set_emax (emax); mpfr_set_prec (x, mp_bits_per_limb + 2); mpfr_set_ui (x, 1, GMP_RNDN); diff --git a/tests/tset.c b/tests/tset.c index 04411a3d1..4f67b035e 100644 --- a/tests/tset.c +++ b/tests/tset.c @@ -80,13 +80,13 @@ main (void) MPFR_ASSERTN(mpfr_cmp_ui (y, 0) == 0 && MPFR_IS_NEG(y)); emax = mpfr_get_emax (); - mpfr_set_emax (0); + set_emax (0); mpfr_set_prec (x, 3); mpfr_set_str_binary (x, "0.111"); mpfr_set_prec (y, 2); mpfr_set (y, x, GMP_RNDU); MPFR_ASSERTN(mpfr_inf_p (y) && mpfr_sgn (y) > 0); - mpfr_set_emax (emax); + set_emax (emax); mpfr_set_prec (y, 11); mpfr_set_str_binary (y, "0.11111111100E-8"); diff --git a/tests/tset_exp.c b/tests/tset_exp.c index 27381345a..9e29206f2 100644 --- a/tests/tset_exp.c +++ b/tests/tset_exp.c @@ -38,11 +38,11 @@ main (int argc, char *argv[]) ret = mpfr_set_exp (x, 2); MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui (x, 2) == 0); - mpfr_set_emin (-1); + set_emin (-1); ret = mpfr_set_exp (x, -1); MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui_2exp (x, 1, -2) == 0); - mpfr_set_emax (1); + set_emax (1); ret = mpfr_set_exp (x, 1); MPFR_ASSERTN(ret == 0 && mpfr_cmp_ui (x, 1) == 0); diff --git a/tests/tset_ld.c b/tests/tset_ld.c index dbf806b0b..3fd7397f3 100644 --- a/tests/tset_ld.c +++ b/tests/tset_ld.c @@ -172,14 +172,14 @@ main (int argc, char *argv[]) /* check with reduced emax to exercise overflow */ emax = mpfr_get_emax (); mpfr_set_prec (x, 2); - mpfr_set_emax (1); + set_emax (1); mpfr_set_ld (x, (long double) 2.0, GMP_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); for (d = (long double) 2.0, i = 0; i < 13; i++, d *= d); /* now d = 2^8192 */ mpfr_set_ld (x, d, GMP_RNDN); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); - mpfr_set_emax (emax); + set_emax (emax); mpfr_clear (x); diff --git a/tests/tset_si.c b/tests/tset_si.c index 9f4771283..777f222ea 100644 --- a/tests/tset_si.c +++ b/tests/tset_si.c @@ -190,17 +190,17 @@ main (int argc, char *argv[]) /* check potential bug in case mp_limb_t is unsigned */ emax = mpfr_get_emax (); - mpfr_set_emax (0); + set_emax (0); mpfr_set_si (x, -1, GMP_RNDN); if (mpfr_sgn (x) >= 0) { printf ("mpfr_set_si (x, -1) fails\n"); exit (1); } - mpfr_set_emax (emax); + set_emax (emax); emax = mpfr_get_emax (); - mpfr_set_emax (5); + set_emax (5); mpfr_set_prec (x, 2); mpfr_set_si (x, -31, GMP_RNDN); if (mpfr_sgn (x) >= 0) @@ -208,7 +208,7 @@ main (int argc, char *argv[]) printf ("mpfr_set_si (x, -31) fails\n"); exit (1); } - mpfr_set_emax (emax); + set_emax (emax); /* test for get_ui */ mpfr_set_ui (x, 0, GMP_RNDN); @@ -244,13 +244,13 @@ main (int argc, char *argv[]) mpfr_set_ui (x, 7, GMP_RNDU); MPFR_ASSERTN(mpfr_cmp_ui (x, 8) == 0); emax = mpfr_get_emax (); - mpfr_set_emax (3); + set_emax (3); mpfr_set_ui (x, 7, GMP_RNDU); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); - mpfr_set_emax (1); + set_emax (1); MPFR_ASSERTN( mpfr_set_ui (x, 7, GMP_RNDU) ); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); - mpfr_set_emax (emax); + set_emax (emax); /* Test for ERANGE flag + correct behaviour if overflow */ mpfr_set_prec (x, 256); diff --git a/tests/tset_str.c b/tests/tset_str.c index 1b6d8fe72..be520eb07 100644 --- a/tests/tset_str.c +++ b/tests/tset_str.c @@ -55,7 +55,7 @@ check_underflow (void) /* Check underflow */ emin = mpfr_get_emin (); - mpfr_set_emin (-20); + set_emin (-20); res = mpfr_set_str (a, "0.00000000001", 10, GMP_RNDZ); if (!MPFR_IS_ZERO (a)) { @@ -65,18 +65,18 @@ check_underflow (void) mpfr_dump (a); exit (1); } - mpfr_set_emin (emin); + set_emin (emin); /* check overflow */ emax = mpfr_get_emax (); - mpfr_set_emax (1073741823); /* 2^30-1 */ + set_emax (1073741823); /* 2^30-1 */ mpfr_set_str (a, "2E1000000000", 10, GMP_RNDN); if (!mpfr_inf_p (a) || mpfr_sgn (a) < 0) { printf("ERROR for mpfr_set_str (a, \"2E1000000000\", 10, GMP_RNDN);\n"); exit (1); } - mpfr_set_emax (emax); + set_emax (emax); mpfr_clear (a); } diff --git a/tests/tset_z.c b/tests/tset_z.c index f0f49f5fc..f733b4f40 100644 --- a/tests/tset_z.c +++ b/tests/tset_z.c @@ -94,27 +94,27 @@ check_large (void) /* check overflow */ emax = mpfr_get_emax (); - mpfr_set_emax (2); + set_emax (2); mpz_set_str (z, "7", 10); mpfr_set_z (x, z, GMP_RNDU); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); - mpfr_set_emax (3); + set_emax (3); mpfr_set_prec (x, 2); mpz_set_str (z, "7", 10); mpfr_set_z (x, z, GMP_RNDU); MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); - mpfr_set_emax (emax); + set_emax (emax); /* check underflow */ emin = mpfr_get_emin (); - mpfr_set_emin (3); + set_emin (3); mpz_set_str (z, "1", 10); mpfr_set_z (x, z, GMP_RNDZ); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); - mpfr_set_emin (2); + set_emin (2); mpfr_set_z (x, z, GMP_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); - mpfr_set_emin (emin); + set_emin (emin); mpz_clear (z); mpfr_clear (x); diff --git a/tests/tsub1sp.c b/tests/tsub1sp.c index 3983a9f6a..3e36a3369 100644 --- a/tests/tsub1sp.c +++ b/tests/tsub1sp.c @@ -470,7 +470,7 @@ void check_special(void) STD_ERROR2; es = mpfr_get_emin (); - mpfr_set_emin (-1024); + set_emin (-1024); mpfr_set_str_binary (y, "0.10000000000000000000000000000000" @@ -498,7 +498,7 @@ void check_special(void) if (inexact1 != inexact2) STD_ERROR2; - mpfr_set_emin(es); + set_emin (es); } diff --git a/tests/ttanh.c b/tests/ttanh.c index c99c8331c..f66aa170c 100644 --- a/tests/ttanh.c +++ b/tests/ttanh.c @@ -60,8 +60,8 @@ special_overflow (void) { mpfr_t x, y; - mpfr_set_emin (-125); - mpfr_set_emax (128); + set_emin (-125); + set_emax (128); mpfr_init2 (x, 24); mpfr_init2 (y, 24); mpfr_set_str_binary (x, "0.101100100000000000110100E7"); @@ -74,8 +74,8 @@ special_overflow (void) } mpfr_clear (y); mpfr_clear (x); - mpfr_set_emin (MPFR_EMIN_MIN); - mpfr_set_emax (MPFR_EMAX_MAX); + set_emin (MPFR_EMIN_MIN); + set_emax (MPFR_EMAX_MAX); } int |