summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2015-07-16 12:43:22 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2015-07-16 12:43:22 +0000
commit1bca62e60e0b443e310b7633ee96dc92d49c6bfd (patch)
tree80cef489478ab108612745f7231c0190005c079a
parent2c5bb5564fb00fe7f48c0c1bfaece82649b3b96a (diff)
downloadmpfr-1bca62e60e0b443e310b7633ee96dc92d49c6bfd.tar.gz
[tests/tfrexp.c]
* Replaced each mpfr_get_exp occurrence by the internal MPFR_GET_EXP macro in order to make sure that an assertion failure is triggered in case of singular number (see also the comment added in r9618). * Fixed the remaining problem due to an overflow and infinite value. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9619 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--tests/tfrexp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/tfrexp.c b/tests/tfrexp.c
index 7fa15273e..0f4ed572c 100644
--- a/tests/tfrexp.c
+++ b/tests/tfrexp.c
@@ -147,9 +147,9 @@ static void check1 (void)
{
/* Test the exponents up to 3 and with the maximum exponent
(to check potential intermediate overflow). */
- if (mpfr_get_exp (x) == 4)
+ if (MPFR_GET_EXP (x) == 4)
mpfr_set_exp (x, MPFR_EMAX_MAX);
- e = mpfr_get_exp (x);
+ e = MPFR_GET_EXP (x);
for (neg = 0; neg < 2; neg++)
{
RND_LOOP (r)
@@ -162,6 +162,8 @@ static void check1 (void)
{
if (red)
{
+ /* e1: exponent of the rounded value of x. */
+ MPFR_ASSERTN (e1 == e || e1 == e + 1);
set_emin (e);
set_emax (e);
mpfr_clear_flags ();
@@ -173,7 +175,7 @@ static void check1 (void)
else
{
inex1 = mpfr_set (y1, x, (mpfr_rnd_t) r);
- e1 = mpfr_get_exp (y1);
+ e1 = MPFR_IS_INF (y1) ? e + 1 : MPFR_GET_EXP (y1);
flags1 = inex1 != 0 ? MPFR_FLAGS_INEXACT : 0;
}
mpfr_clear_flags ();
@@ -182,7 +184,7 @@ static void check1 (void)
set_emin (MPFR_EMIN_MIN);
set_emax (MPFR_EMAX_MAX);
if ((!red || e == 0) &&
- (! mpfr_regular_p (y2) || mpfr_get_exp (y2) != 0))
+ (! mpfr_regular_p (y2) || MPFR_GET_EXP (y2) != 0))
{
printf ("Error in check1 for %s, red = %d, x = ",
mpfr_print_rnd_mode ((mpfr_rnd_t) r), red);