diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2012-02-23 13:52:04 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2012-02-23 13:52:04 +0000 |
commit | 76e2960f5248c20dd2591b76901baefd5b57fe34 (patch) | |
tree | 83fe8aed49953f5e765575b1abc05ffc85fbad02 /examples | |
parent | f6d034ece31ec8ccc008ee5a0231f4c2b9d8471d (diff) | |
download | mpfr-76e2960f5248c20dd2591b76901baefd5b57fe34.tar.gz |
[examples/version.c] Output mpfr_prec_t information with all MPFR
versions. Output signedness information for MPFR types/macros.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8036 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'examples')
-rw-r--r-- | examples/version.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/examples/version.c b/examples/version.c index 0acd5eb54..56a1de6a7 100644 --- a/examples/version.c +++ b/examples/version.c @@ -29,6 +29,9 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include <gmp.h> #include <mpfr.h> +#define SIGNED_STR(V) ((V) < 0 ? "signed" : "unsigned") +#define SIGNED(I) SIGNED_STR((I) - (I) - 1) + /* The following failure can occur if GMP has been rebuilt with * a different ABI, e.g. * 1. GMP built with ABI=mode32. @@ -99,18 +102,22 @@ int main (void) printf ("Warning! This is different from GMP_LIMB_BITS!\n" "Different ABI caused by a GMP library upgrade?\n"); -#if MPFR_VERSION_MAJOR >= 3 printf ("\n"); - printf ("sizeof(mpfr_prec_t) = %d\n", (int) sizeof(mpfr_prec_t)); - printf ("sizeof(mpfr_exp_t) = %d\n", (int) sizeof(mpfr_exp_t)); + printf ("sizeof(mpfr_prec_t) = %d (%s type)\n", (int) sizeof(mpfr_prec_t), + SIGNED_STR((mpfr_prec_t) -1)); +#if MPFR_VERSION_MAJOR >= 3 + printf ("sizeof(mpfr_exp_t) = %d (%s type)\n", (int) sizeof(mpfr_exp_t), + SIGNED_STR((mpfr_exp_t) -1)); #endif #ifdef _MPFR_PREC_FORMAT printf ("_MPFR_PREC_FORMAT = %d\n", (int) _MPFR_PREC_FORMAT); #endif /* Note: "long" is sufficient for all current _MPFR_PREC_FORMAT values (1, 2, 3). Thus we do not need to depend on ISO C99 or later. */ - printf ("MPFR_PREC_MIN = %ld\n", (long) MPFR_PREC_MIN); - printf ("MPFR_PREC_MAX = %ld\n", (long) MPFR_PREC_MAX); + printf ("MPFR_PREC_MIN = %ld (%s)\n", (long) MPFR_PREC_MIN, + SIGNED (MPFR_PREC_MIN)); + printf ("MPFR_PREC_MAX = %ld (%s)\n", (long) MPFR_PREC_MAX, + SIGNED (MPFR_PREC_MAX)); #ifdef _MPFR_EXP_FORMAT printf ("_MPFR_EXP_FORMAT = %d\n", (int) _MPFR_EXP_FORMAT); #endif |