summaryrefslogtreecommitdiff
path: root/tests/tsub1sp.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-16 16:17:38 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-16 16:17:38 +0000
commitc507882678500338e756e97555303f76b833c721 (patch)
treee8814903afee5a6160d8b68f18f6797338b04f01 /tests/tsub1sp.c
parent4da11852b95bb92f71d7bbdb935114eb96095f82 (diff)
downloadmpfr-c507882678500338e756e97555303f76b833c721.tar.gz
Optimize add1sp, sub1sp and div.
Improve coverage test for sub1sp. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2730 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tsub1sp.c')
-rw-r--r--tests/tsub1sp.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/tsub1sp.c b/tests/tsub1sp.c
index 64250eda2..acfd92784 100644
--- a/tests/tsub1sp.c
+++ b/tests/tsub1sp.c
@@ -102,6 +102,7 @@ void check_special(void)
mp_rnd_t r;
mpfr_prec_t p;
int i = -1, inexact1, inexact2;
+ mp_exp_t es;
mpfr_inits(x,y,z,x2,NULL);
@@ -442,6 +443,67 @@ void check_special(void)
if (inexact1 != inexact2)
STD_ERROR2;
+ p = 64;
+ mpfr_set_prec(x, p); mpfr_set_prec(x2, p);
+ mpfr_set_prec(y, p); mpfr_set_prec(z, p);
+
+ mpfr_set_str_binary (y,
+ "0.11000000000000000000000000000000"
+ "00000000000000000000000000000000E1");
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000"
+ "00000000000000000000000000000001E0");
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.11000000000000000000000000000000"
+ "000000000000000000000000000001E1");
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000"
+ "00000000000000000000000000000001E0");
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ es = mpfr_get_emin ();
+ mpfr_set_emin (-1024);
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000"
+ "000000000000000000000000000000E-1023");
+ mpfr_set_str_binary (z,
+ "0.10000000000000000000000000000000"
+ "00000000000000000000000000000001E-1023");
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_str_binary (y,
+ "0.10000000000000000000000000000000"
+ "000000000000000000000000000000E-1023");
+ mpfr_set_str_binary (z,
+ "0.1000000000000000000000000000000"
+ "000000000000000000000000000000E-1023");
+ inexact1 = mpfr_sub1(x2, y, z, r);
+ inexact2 = mpfr_sub1sp(x, y, z, r);
+ if (mpfr_cmp(x, x2))
+ STD_ERROR;
+ if (inexact1 != inexact2)
+ STD_ERROR2;
+
+ mpfr_set_emin(es);
+
}
mpfr_clears(x,y,z,x2,NULL);