summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2015-11-01 14:56:35 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2015-11-01 14:56:35 +0100
commit514f0162d8dc9484f17ff02d0bcb45971bd62449 (patch)
tree429cc6cbf5c070a5151eaeaa0f896bd1175c21a0
parent3a155c38edb235514f1e2ca98c43165b0dbbe858 (diff)
downloadgmp-514f0162d8dc9484f17ff02d0bcb45971bd62449.tar.gz
tests/mpf/t-pow_ui.c: Use another mpf for the size limit.
-rw-r--r--tests/mpf/t-pow_ui.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/mpf/t-pow_ui.c b/tests/mpf/t-pow_ui.c
index 634544d0e..d70b17cf4 100644
--- a/tests/mpf/t-pow_ui.c
+++ b/tests/mpf/t-pow_ui.c
@@ -28,12 +28,14 @@ void
check_data (void)
{
unsigned int b, e;
- mpf_t b1, r, r2;
+ mpf_t b1, r, r2, limit;
mpf_inits (b1, r, r2, NULL);
+ mpf_init_set_ui (limit, 1);
+ mpf_mul_2exp (limit, limit, MAX (GMP_NUMB_BITS, 53));
/* This test just test integers with results that fit in a single
- limb. This avoid any rounding. */
+ limb or 53 bits. This avoids any rounding. */
for (b = 0; b <= 400; b++)
{
@@ -48,12 +50,12 @@ check_data (void)
mpf_mul_ui (r2, r2, b);
- if (mpf_cmp_ui (r2, GMP_NUMB_MAX) > 0)
+ if (mpf_cmp (r2, limit) >= 0)
break;
}
}
- mpf_clears (b1, r, r2, NULL);
+ mpf_clears (b1, r, r2, limit, NULL);
}
int