summaryrefslogtreecommitdiff
path: root/tests/tset_si.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-05-29 12:27:01 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-05-29 12:27:01 +0000
commit4d76481f8f339d291ece5a3cf8a92e7819a86fc5 (patch)
treedcd13abf6a38a1f66a54faf61e7420804f334f72 /tests/tset_si.c
parentaf5a1593331d686b9cc5fbbbbdc47e1733a4644e (diff)
parent3a19337c08a0109b3d1554b0deb565bdb7eb0a9e (diff)
downloadmpfr-4d76481f8f339d291ece5a3cf8a92e7819a86fc5.tar.gz
Merged the latest changes from the trunk.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/faithful@11543 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tset_si.c')
-rw-r--r--tests/tset_si.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/tests/tset_si.c b/tests/tset_si.c
index f4694c828..7bd66a70e 100644
--- a/tests/tset_si.c
+++ b/tests/tset_si.c
@@ -22,7 +22,8 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
-#define ERROR(str) do { printf ("Error for " str "\n"); exit (1); } while (0)
+#define PRINT_ERROR(str) \
+ do { printf ("Error for %s\n", str); exit (1); } while (0)
static void
test_2exp (void)
@@ -34,57 +35,57 @@ test_2exp (void)
mpfr_set_ui_2exp (x, 1, 0, MPFR_RNDN);
if (mpfr_cmp_ui (x, 1) != 0)
- ERROR ("(1U,0)");
+ PRINT_ERROR ("(1U,0)");
mpfr_set_ui_2exp (x, 1024, -10, MPFR_RNDN);
if (mpfr_cmp_ui(x, 1) != 0)
- ERROR ("(1024U,-10)");
+ PRINT_ERROR ("(1024U,-10)");
mpfr_set_ui_2exp (x, 1024, 10, MPFR_RNDN);
if (mpfr_cmp_ui (x, 1024 * 1024) != 0)
- ERROR ("(1024U,+10)");
+ PRINT_ERROR ("(1024U,+10)");
mpfr_set_si_2exp (x, -1024L * 1024L, -10, MPFR_RNDN);
if (mpfr_cmp_si (x, -1024) != 0)
- ERROR ("(1M,-10)");
+ PRINT_ERROR ("(1M,-10)");
mpfr_set_ui_2exp (x, 0x92345678, 16, MPFR_RNDN);
if (mpfr_cmp_str (x, "92345678@4", 16, MPFR_RNDN) != 0)
- ERROR ("(x92345678U,+16)");
+ PRINT_ERROR ("(x92345678U,+16)");
mpfr_set_si_2exp (x, -0x1ABCDEF0, -256, MPFR_RNDN);
if (mpfr_cmp_str (x, "-1ABCDEF0@-64", 16, MPFR_RNDN) != 0)
- ERROR ("(-x1ABCDEF0,-256)");
+ PRINT_ERROR ("(-x1ABCDEF0,-256)");
mpfr_set_prec (x, 2);
res = mpfr_set_si_2exp (x, 7, 10, MPFR_RNDU);
if (mpfr_cmp_ui (x, 1<<13) != 0 || res <= 0)
- ERROR ("Prec 2 + si_2exp");
+ PRINT_ERROR ("Prec 2 + si_2exp");
res = mpfr_set_ui_2exp (x, 7, 10, MPFR_RNDU);
if (mpfr_cmp_ui (x, 1<<13) != 0 || res <= 0)
- ERROR ("Prec 2 + ui_2exp");
+ PRINT_ERROR ("Prec 2 + ui_2exp");
mpfr_clear_flags ();
mpfr_set_ui_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN);
if (!mpfr_inf_p (x) || MPFR_IS_NEG (x))
- ERROR ("mpfr_set_ui_2exp and overflow (bad result)");
+ PRINT_ERROR ("mpfr_set_ui_2exp and overflow (bad result)");
if (!mpfr_overflow_p ())
- ERROR ("mpfr_set_ui_2exp and overflow (overflow flag not set)");
+ PRINT_ERROR ("mpfr_set_ui_2exp and overflow (overflow flag not set)");
mpfr_clear_flags ();
mpfr_set_si_2exp (x, 17, MPFR_EMAX_MAX, MPFR_RNDN);
if (!mpfr_inf_p (x) || MPFR_IS_NEG (x))
- ERROR ("mpfr_set_si_2exp (pos) and overflow (bad result)");
+ PRINT_ERROR ("mpfr_set_si_2exp (pos) and overflow (bad result)");
if (!mpfr_overflow_p ())
- ERROR ("mpfr_set_si_2exp (pos) and overflow (overflow flag not set)");
+ PRINT_ERROR ("mpfr_set_si_2exp (pos) and overflow (overflow flag not set)");
mpfr_clear_flags ();
mpfr_set_si_2exp (x, -17, MPFR_EMAX_MAX, MPFR_RNDN);
if (!mpfr_inf_p (x) || MPFR_IS_POS (x))
- ERROR ("mpfr_set_si_2exp (neg) and overflow (bad result)");
+ PRINT_ERROR ("mpfr_set_si_2exp (neg) and overflow (bad result)");
if (!mpfr_overflow_p ())
- ERROR ("mpfr_set_si_2exp (neg) and overflow (overflow flag not set)");
+ PRINT_ERROR ("mpfr_set_si_2exp (neg) and overflow (overflow flag not set)");
mpfr_clear (x);
}