summaryrefslogtreecommitdiff
path: root/tests/tset_sj.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-03-29 14:39:22 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2019-03-29 14:39:22 +0000
commit2fd87b60186385c3d19446d39d6d610b33e3e076 (patch)
tree5988ae8c88a34b00c09bd92a1e0ea57e26020b8b /tests/tset_sj.c
parent2cb68bb1c40eb69e96f00858812c8f52f446f6ea (diff)
downloadmpfr-2fd87b60186385c3d19446d39d6d610b33e3e076.tar.gz
Cleanup / fixes related to intmax_t, mpfr_intmax_t, etc.
The issues were: * The build of the tests (make check) could fail with CFLAGS implying "-std=c90 -Werror=format", i.e. if intmax_t was available but the use of the "j" printf length modifier made the compilation fail (its unconditional use was incorrect anyway). * MPFR_INTMAX_MAX had definitions in both mpfr-impl.h & mpfr-intmax.h, with inconsistent usage. Detailed changes: * acinclude.m4: removed the definition of MPFR_PRINTF_MAXLM, which could be incorrect (large numbers were not tested to select its value); in the MPFR_FUNC_GMP_PRINTF_SPEC macro, check sprintf() in addition to gmp_sprintf() as it is now also used in the tests; updated some comments and messages. * src/mpfr-impl.h: removed the MPFR_*INTMAX* definitions; they had been added due to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=582698 with -ansi -pedantic-errors, but this issue was fixed in GCC 4.8 (released 6 years ago), so that they are no longer needed. * src/mpfr-intmax.h: completed the definitions; mpfr_intmax_t is now the largest integer type available and fully working (in particular with printf), thus it may be smaller than intmax_t. * doc/README.dev: updated the description of mpfr_intmax_t, etc. * tests/tversion.c: output sizeof(mpfr_intmax_t) too. * Various .c files in src and tests related to (u)intmax_t: use INTMAX_MAX instead of MPFR_INTMAX_MAX, etc. as Debian bug 582698 (mentioned above) no longer occurs and mpfr_intmax_t may be smaller than intmax_t; use the "j" printf length modifier instead of MPFR_PRINTF_MAXLM, and protect it with "#ifndef NPRINTF_J" (only the tests are concerned, so that this is not an issue). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13457 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 2f4b9760a..72029ddd8 100644
--- a/tests/tset_sj.c
+++ b/tests/tset_sj.c
@@ -87,7 +87,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, MPFR_UINTMAX_MAX, MPFR_RNDN);
+ inex1 = mpfr_set_uj (x, UINTMAX_MAX, MPFR_RNDN);
if (inex1 != 0 || mpfr_sgn(x) <= 0)
PRINT_ERROR ("inexact / UINTMAX_MAX");
inex1 = mpfr_add_ui (x, x, 1, MPFR_RNDN);
@@ -121,18 +121,18 @@ check_set_uj_2exp (void)
if (inex || mpfr_cmp_ui(x, 1024L * 1024L))
PRINT_ERROR ("(1024U,+10)");
- inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, 1000, MPFR_RNDN);
+ inex = mpfr_set_uj_2exp (x, 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)
PRINT_ERROR ("(UINTMAX_MAX)");
- inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, MPFR_EMAX_MAX-10, MPFR_RNDN);
+ inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMAX_MAX-10, MPFR_RNDN);
if (inex == 0 || !mpfr_inf_p (x))
PRINT_ERROR ("Overflow");
- inex = mpfr_set_uj_2exp (x, MPFR_UINTMAX_MAX, MPFR_EMIN_MIN-1000, MPFR_RNDN);
+ inex = mpfr_set_uj_2exp (x, UINTMAX_MAX, MPFR_EMIN_MIN-1000, MPFR_RNDN);
if (inex == 0 || !MPFR_IS_ZERO (x))
PRINT_ERROR ("Underflow");
@@ -147,7 +147,7 @@ check_set_sj (void)
mpfr_init2 (x, sizeof(intmax_t)*CHAR_BIT-1);
- inex = mpfr_set_sj (x, -MPFR_INTMAX_MAX, MPFR_RNDN);
+ inex = mpfr_set_sj (x, -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)
@@ -168,7 +168,7 @@ check_set_sj_2exp (void)
mpfr_init2 (x, sizeof(intmax_t)*CHAR_BIT-1);
- inex = mpfr_set_sj_2exp (x, MPFR_INTMAX_MIN, 1000, MPFR_RNDN);
+ inex = mpfr_set_sj_2exp (x, INTMAX_MIN, 1000, MPFR_RNDN);
if (inex || mpfr_sgn (x) >=0 || !mpfr_powerof2_raw (x)
|| MPFR_EXP (x) != sizeof(intmax_t) * CHAR_BIT + 1000)
PRINT_ERROR ("set_sj_2exp (INTMAX_MIN)");