summaryrefslogtreecommitdiff
path: root/tests/tcmp.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2003-11-21 15:27:35 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2003-11-21 15:27:35 +0000
commit41d7b44241b63a451c3e664bdd9a640a4c255291 (patch)
tree6a82613a3cf86ab03825e93e2987ad51e8ab58a6 /tests/tcmp.c
parent1cd11b42766c57e2118aac4ffe5219fac353904d (diff)
downloadmpfr-41d7b44241b63a451c3e664bdd9a640a4c255291.tar.gz
+ Add new internal function: mpfr_check.
+ Add the corresponding test file. + Translate mpfr_set_d to mpfr_set_str / mpfr_set_ui in the tests for portability reasons. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2562 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tcmp.c')
-rw-r--r--tests/tcmp.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/tcmp.c b/tests/tcmp.c
index 4366b4670..f9bdfc234 100644
--- a/tests/tcmp.c
+++ b/tests/tcmp.c
@@ -80,16 +80,16 @@ main (void)
}
mpfr_set_prec(xx, 53); mpfr_set_prec(yy, 200);
- mpfr_set_d(xx, 1.0, 0);
- mpfr_set_d(yy, 1.0, 0);
- if (mpfr_cmp(xx,yy)!=0)
+ mpfr_set_ui(xx, 1, 0);
+ mpfr_set_ui(yy, 1, 0);
+ if (mpfr_cmp(xx, yy) != 0)
{
printf ("Error in mpfr_cmp: 1.0 != 1.0\n");
exit (1);
}
mpfr_set_prec(yy, 31);
- mpfr_set_d(xx, 1.0000000002, 0);
- mpfr_set_d(yy, 1.0, 0);
+ mpfr_set_str(xx, "1.0000000002", 10, 0);
+ mpfr_set_ui(yy, 1, 0);
if (!(mpfr_cmp(xx,yy)>0))
{
printf ("Error in mpfr_cmp: not 1.0000000002 > 1.0\n");
@@ -98,8 +98,8 @@ main (void)
mpfr_set_prec(yy, 53);
/* bug found by Gerardo Ballabio */
- mpfr_set_d(xx, 0.0, GMP_RNDN);
- mpfr_set_d(yy, 0.1, GMP_RNDN);
+ mpfr_set_ui(xx, 0, GMP_RNDN);
+ mpfr_set_str (yy, "0.1", 10, GMP_RNDN);
if (mpfr_cmp(xx, yy) >= 0)
{
printf ("Error in mpfr_cmp(0.0, 0.1), gives %d\n", mpfr_cmp(xx, yy));
@@ -107,7 +107,7 @@ main (void)
}
mpfr_set_inf (xx, 1);
- mpfr_set_d(yy, -23489745.0329, GMP_RNDN);
+ mpfr_set_str (yy, "-23489745.0329", 10, GMP_RNDN);
if (mpfr_cmp(xx, yy) <= 0)
{
printf ("Error in mpfr_cmp(Infp, 23489745.0329), gives %d\n",
@@ -148,7 +148,7 @@ main (void)
}
mpfr_set_inf (xx, -1);
- mpfr_set_d(yy, 2346.09234, GMP_RNDN);
+ mpfr_set_str (yy, "2346.09234", 10, GMP_RNDN);
if (mpfr_cmp(xx, yy) >= 0)
{
printf ("Error in mpfr_cmp(Infm, 2346.09234), gives %d\n",
@@ -156,8 +156,8 @@ main (void)
exit (1);
}
- mpfr_set_d (xx, 0.0, GMP_RNDN);
- mpfr_set_d (yy, 1.0, GMP_RNDN);
+ mpfr_set_ui (xx, 0, GMP_RNDN);
+ mpfr_set_ui (yy, 1, GMP_RNDN);
if ((i = mpfr_cmp3 (xx, yy, 1)) >= 0)
{
printf ("Error: mpfr_cmp3 (0, 1, 1) gives %d instead of"
@@ -178,8 +178,8 @@ main (void)
if (!Isnan(x) && !Isnan(y))
{
i++;
- mpfr_set_d (xx, x, 0);
- mpfr_set_d (yy, y, 0);
+ mpfr_set_d (xx, x, GMP_RNDN);
+ mpfr_set_d (yy, y, GMP_RNDN);
c = mpfr_cmp (xx,yy);
if ((c>0 && x<=y) || (c==0 && x!=y) || (c<0 && x>=y))
{