summaryrefslogtreecommitdiff
path: root/tests/tset_sj.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2010-05-22 22:42:05 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2010-05-22 22:42:05 +0000
commit1335e137521427dad7842e8d53b735888bbd3f69 (patch)
tree98106dfe9980b801fb500c090f2588ef36002214 /tests/tset_sj.c
parent46c98af89f900d1074e842532fb064f84bd3fbd3 (diff)
downloadmpfr-1335e137521427dad7842e8d53b735888bbd3f69.tar.gz
Detect when the intmax_t type is available but INTMAX_MAX doesn't work
(e.g. with gcc -ansi -pedantic-errors in 32-bit mode under GNU/Linux). New macros MPFR_UINTMAX_MAX, MPFR_INTMAX_MAX and MPFR_INTMAX_MIN are defined and used internally instead of UINTMAX_MAX, INTMAX_MAX and INTMAX_MIN. If these C99 macros work, then the MPFR_* macros use them, otherwise MPFR uses its own definitions. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6849 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tset_sj.c')
-rw-r--r--tests/tset_sj.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/tset_sj.c b/tests/tset_sj.c
index 6834baf1a..843cf450e 100644
--- a/tests/tset_sj.c
+++ b/tests/tset_sj.c
@@ -101,7 +101,7 @@ check_set_uj (mpfr_prec_t pmin, mpfr_prec_t pmax, int N)
}
/* Special case */
mpfr_set_prec (x, sizeof(uintmax_t)*CHAR_BIT);
- inex1 = mpfr_set_uj (x, UINTMAX_MAX, MPFR_RNDN);
+ inex1 = mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);
if (inex1 != 0 || mpfr_sgn(x) <= 0)
ERROR ("inexact / UINTMAX_MAX");
inex1 = mpfr_add_ui (x, x, 1, MPFR_RNDN);
@@ -135,18 +135,18 @@ check_set_uj_2exp (void)
if (inex || mpfr_cmp_ui(x, 1024L * 1024L))
ERROR("(1024U,+10)");
- inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, 1000, MPFR_RNDN);
+ inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, 1000, MPFR_RNDN);
inex |= mpfr_div_2ui (x, x, 1000, MPFR_RNDN);
inex |= mpfr_add_ui (x, x, 1, MPFR_RNDN);
if (inex || !mpfr_powerof2_raw (x)
|| MPFR_EXP (x) != (sizeof(uintmax_t)*CHAR_BIT+1) )
ERROR("(UINTMAX_MAX)");
- inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMAX_MAX-10, MPFR_RNDN);
+ inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, MPFR_EMAX_MAX-10, MPFR_RNDN);
if (inex == 0 || !mpfr_inf_p (x))
ERROR ("Overflow");
- inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMIN_MIN-1000, MPFR_RNDN);
+ inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, MPFR_EMIN_MIN-1000, MPFR_RNDN);
if (inex == 0 || !MPFR_IS_ZERO (x))
ERROR ("Underflow");
@@ -161,7 +161,7 @@ check_set_sj (void)
mpfr_init2 (x, sizeof(intmax_t)*CHAR_BIT-1);
- inex = mpfr_set_sj (x, -INTMAX_MAX, MPFR_RNDN);
+ inex = mpfr_set_sj (x, -MPFR_INTMAX_MAX, MPFR_RNDN);
inex |= mpfr_add_si (x, x, -1, MPFR_RNDN);
if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x)
|| MPFR_EXP (x) != (sizeof(intmax_t)*CHAR_BIT) )
@@ -182,7 +182,7 @@ check_set_sj_2exp (void)
mpfr_init2 (x, sizeof(intmax_t)*CHAR_BIT-1);
- inex = mpfr_set_sj_2exp (x, INTMAX_MIN, 1000, MPFR_RNDN);
+ inex = mpfr_set_sj_2exp (x, MPFR_INTMAX_MIN, 1000, MPFR_RNDN);
if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x)
|| MPFR_EXP (x) != (sizeof(intmax_t)*CHAR_BIT+1000) )
ERROR("set_sj_2exp (INTMAX_MIN)");