diff options
author | zimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2009-03-29 08:05:30 +0000 |
---|---|---|
committer | zimmerma <zimmerma@211d60ee-9f03-0410-a15a-8952a2c7a4e4> | 2009-03-29 08:05:30 +0000 |
commit | 631e67000b2ad262d8383627f9a729248b96e80f (patch) | |
tree | 6b1b86f4e2a3cb443f47696d12a1b93dee19c8c5 /tests/tset.c | |
parent | 0e2bf6a005bb573937683f24b2a2361b3dea64e0 (diff) | |
download | mpc-631e67000b2ad262d8383627f9a729248b96e80f.tar.gz |
[tset.c] the previous commit did fail on 32-bit machines, because INTMAX_MAX
is a "long long" constant. Now we generate it from LONG_MAX.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@513 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tset.c')
-rw-r--r-- | tests/tset.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/tset.c b/tests/tset.c index 4105068..7fe7882 100644 --- a/tests/tset.c +++ b/tests/tset.c @@ -20,6 +20,7 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" +#include <limits.h> /* for LONG_MAX */ #if HAVE_INTTYPES_H # include <inttypes.h> /* for intmax_t */ @@ -239,13 +240,15 @@ check_set (void) mpc_set_sj_sj (z, im, im, MPC_RNDNN); if (mpfr_cmp_ui (MPC_RE(z), prec) != 0 || mpfr_cmp_ui (MPC_IM(z), prec) != 0) - PRINT_ERROR ("mpc_set_sj_sj", prec, z); + PRINT_ERROR ("mpc_set_sj_sj (1)", prec, z); - im = INTMAX_MAX; + im = LONG_MAX; + if (sizeof (intmax_t) == 2 * sizeof (unsigned long)) + im = 2 * im * im + 4 * im + 1; /* gives 2^(2n-1)-1 from 2^(n-1)-1 */ mpc_set_sj_sj (z, im, im, MPC_RNDNN); if (mpfr_get_sj (MPC_RE(z), GMP_RNDN) != im || mpfr_get_sj (MPC_IM(z), GMP_RNDN) != im) - PRINT_ERROR ("mpc_set_sj_sj", im, z); + PRINT_ERROR ("mpc_set_sj_sj (2)", im, z); } #endif /* _MPC_H_HAVE_INTMAX_T */ } |