summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-01-28 13:56:53 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-01-28 13:56:53 +0000
commit5e7c49abeb921d0ff88251cc979c5aa84011bae5 (patch)
tree8cff4225a9473f6113d3c8039547986977759bba /tests
parent1f198c2b91b8cbd1f28b31bab5df8f24bd855615 (diff)
downloadmpfr-5e7c49abeb921d0ff88251cc979c5aa84011bae5.tar.gz
[tests/tcan_round.c] Updated comments.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9887 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/tcan_round.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/tcan_round.c b/tests/tcan_round.c
index 576f30825..879c0e73f 100644
--- a/tests/tcan_round.c
+++ b/tests/tcan_round.c
@@ -69,15 +69,18 @@ test_pow2 (mpfr_exp_t i, mpfr_prec_t px, mpfr_rnd_t r1, mpfr_rnd_t r2,
mpfr_init2 (x, px);
mpfr_set_ui_2exp (x, 1, i, MPFR_RNDN);
b = !!mpfr_can_round (x, i+1, r1, r2, prec);
+ /* TODO: check the conditions on prec below. */
expected_b =
MPFR_IS_LIKE_RNDD (r1, MPFR_SIGN_POS) ?
(MPFR_IS_LIKE_RNDU (r2, MPFR_SIGN_POS) ? 0 : prec <= i) :
MPFR_IS_LIKE_RNDU (r1, MPFR_SIGN_POS) ?
(MPFR_IS_LIKE_RNDD (r2, MPFR_SIGN_POS) ? 0 : prec <= i) :
(r2 != MPFR_RNDN ? 0 : prec <= i - 1);
- /* we only require mpfr_can_round to return 1 only when we can really
+ /* We only require mpfr_can_round to return 1 only when we can really
round, it is allowed to return 0 in some rare boundary cases,
- for example when x = 2^k and the error is 0.25 ulp. */
+ for example when x = 2^k and the error is 0.25 ulp.
+ Note: if this changes in the future, the test could be improved by
+ removing the "&& expected_b == 0" below. */
if (b != expected_b && expected_b == 0)
{
printf ("Error for x=2^%d, px=%lu, err=%d, r1=%s, r2=%s, prec=%d\n",