summaryrefslogtreecommitdiff
path: root/tests/texceptions.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/texceptions.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/texceptions.c')
-rw-r--r--tests/texceptions.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/texceptions.c b/tests/texceptions.c
index 2f7178d0d..b0e7a39ae 100644
--- a/tests/texceptions.c
+++ b/tests/texceptions.c
@@ -22,7 +22,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#include "mpfr-test.h"
-#define ERROR(s) do { printf(s"\n"); exit(1); } while(0)
+#define PRINT_ERROR(s) do { printf ("%s\n", s); exit (1); } while (0)
/* Test powerof2 */
static void
@@ -52,15 +52,15 @@ check_default_rnd (void)
{
printf ("%s %s\n", mpfr_print_rnd_mode ((mpfr_rnd_t) r),
mpfr_print_rnd_mode (t));
- ERROR("ERROR in setting / getting default rounding mode (1)");
+ PRINT_ERROR ("ERROR in setting / getting default rounding mode (1)");
}
}
mpfr_set_default_rounding_mode ((mpfr_rnd_t) MPFR_RND_MAX);
if (mpfr_get_default_rounding_mode() != MPFR_RNDF)
- ERROR("ERROR in setting / getting default rounding mode (2)");
+ PRINT_ERROR ("ERROR in setting / getting default rounding mode (2)");
mpfr_set_default_rounding_mode((mpfr_rnd_t) -1);
if (mpfr_get_default_rounding_mode() != MPFR_RNDF)
- ERROR("ERROR in setting / getting default rounding mode (3)");
+ PRINT_ERROR ("ERROR in setting / getting default rounding mode (3)");
}
static void
@@ -73,27 +73,27 @@ check_emin_emax (void)
/* Check the functions not the macros ! */
if ((mpfr_set_emin)(MPFR_EMIN_MIN) != 0)
- ERROR("set_emin failed!");
+ PRINT_ERROR ("set_emin failed!");
if ((mpfr_get_emin)() != MPFR_EMIN_MIN)
- ERROR("get_emin FAILED!");
+ PRINT_ERROR ("get_emin FAILED!");
if ((mpfr_set_emin)(MPFR_EMIN_MIN-1) == 0)
- ERROR("set_emin failed! (2)");
+ PRINT_ERROR ("set_emin failed! (2)");
if ((mpfr_set_emax)(MPFR_EMAX_MAX) != 0)
- ERROR("set_emax failed!");
+ PRINT_ERROR ("set_emax failed!");
if ((mpfr_get_emax)() != MPFR_EMAX_MAX)
- ERROR("get_emax FAILED!");
+ PRINT_ERROR ("get_emax FAILED!");
if ((mpfr_set_emax)(MPFR_EMAX_MAX+1) == 0)
- ERROR("set_emax failed! (2)");
+ PRINT_ERROR ("set_emax failed! (2)");
if ((mpfr_get_emin_min) () != MPFR_EMIN_MIN)
- ERROR ("get_emin_min");
+ PRINT_ERROR ("get_emin_min");
if ((mpfr_get_emin_max) () != MPFR_EMIN_MAX)
- ERROR ("get_emin_max");
+ PRINT_ERROR ("get_emin_max");
if ((mpfr_get_emax_min) () != MPFR_EMAX_MIN)
- ERROR ("get_emax_min");
+ PRINT_ERROR ("get_emax_min");
if ((mpfr_get_emax_max) () != MPFR_EMAX_MAX)
- ERROR ("get_emax_max");
+ PRINT_ERROR ("get_emax_max");
set_emin (old_emin);
set_emax (old_emax);
@@ -106,7 +106,7 @@ check_set_get_prec (void)
mpfr_init2 (x, 17);
if (mpfr_get_prec (x) != 17 || (mpfr_get_prec)(x) != 17)
- ERROR ("mpfr_get_prec");
+ PRINT_ERROR ("mpfr_get_prec");
mpfr_clear (x);
}
@@ -115,10 +115,10 @@ mpfr_set_double_range (void)
{
mpfr_set_default_prec (54);
if (mpfr_get_default_prec () != 54)
- ERROR ("get_default_prec failed (1)");
+ PRINT_ERROR ("get_default_prec failed (1)");
mpfr_set_default_prec (53);
if ((mpfr_get_default_prec) () != 53)
- ERROR ("get_default_prec failed (2)");
+ PRINT_ERROR ("get_default_prec failed (2)");
/* in double precision format, the unbiased exponent is between 0 and
2047, where 0 is used for subnormal numbers, and 2047 for special
@@ -154,32 +154,32 @@ check_flags (void)
(mpfr_clear_overflow)();
mpfr_mul_2exp (x, x, 1024, MPFR_RNDN);
if (!(mpfr_overflow_p)())
- ERROR("ERROR: No overflow detected!\n");
+ PRINT_ERROR ("ERROR: No overflow detected!\n");
(mpfr_clear_underflow)();
mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_div_2exp (x, x, 1025, MPFR_RNDN);
if (!(mpfr_underflow_p)())
- ERROR("ERROR: No underflow detected!\n");
+ PRINT_ERROR ("ERROR: No underflow detected!\n");
(mpfr_clear_nanflag)();
MPFR_SET_NAN(x);
mpfr_add (x, x, x, MPFR_RNDN);
if (!(mpfr_nanflag_p)())
- ERROR("ERROR: No NaN flag!\n");
+ PRINT_ERROR ("ERROR: No NaN flag!\n");
(mpfr_clear_inexflag)();
mpfr_set_ui(x, 2, MPFR_RNDN);
mpfr_cos(x, x, MPFR_RNDN);
if (!(mpfr_inexflag_p)())
- ERROR("ERROR: No inexact flag!\n");
+ PRINT_ERROR ("ERROR: No inexact flag!\n");
(mpfr_clear_erangeflag) ();
mpfr_set_ui (x, 1, MPFR_RNDN);
mpfr_mul_2exp (x, x, 1024, MPFR_RNDN);
mpfr_get_ui (x, MPFR_RNDN);
if (!(mpfr_erangeflag_p)())
- ERROR ("ERROR: No erange flag!\n");
+ PRINT_ERROR ("ERROR: No erange flag!\n");
mpfr_clear (x);
set_emin (old_emin);