diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2019-03-29 14:39:22 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2019-03-29 14:39:22 +0000 |
commit | 2fd87b60186385c3d19446d39d6d610b33e3e076 (patch) | |
tree | 5988ae8c88a34b00c09bd92a1e0ea57e26020b8b /src/fits_intmax.c | |
parent | 2cb68bb1c40eb69e96f00858812c8f52f446f6ea (diff) | |
download | mpfr-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 'src/fits_intmax.c')
-rw-r--r-- | src/fits_intmax.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/fits_intmax.c b/src/fits_intmax.c index c5f7f6873..c11aff5f2 100644 --- a/src/fits_intmax.c +++ b/src/fits_intmax.c @@ -63,13 +63,13 @@ mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) { uintmax_t s; /* In C89, the division on negative integers isn't well-defined. */ - s = SAFE_ABS (uintmax_t, MPFR_INTMAX_MIN); + s = SAFE_ABS (uintmax_t, INTMAX_MIN); for (prec = 0; s != 0; s /= 2, prec ++); } else { intmax_t s; - s = MPFR_INTMAX_MAX; + s = INTMAX_MAX; for (prec = 0; s != 0; s /= 2, prec ++); } @@ -95,7 +95,7 @@ mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) if (neg) { mpfr_init2 (y, prec); - mpfr_set_sj (y, MPFR_INTMAX_MIN, MPFR_RNDN); + mpfr_set_sj (y, INTMAX_MIN, MPFR_RNDN); res = mpfr_cmp (x, y) >= 0; mpfr_clear (y); } |