summaryrefslogtreecommitdiff
path: root/tests/tcmp.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-01-04 02:57:08 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-01-04 02:57:08 +0000
commitfc14d0126c36bb74758aed6e24281f13e1590407 (patch)
tree90828a9cc56b328b18ea7c8e7bfed1991f431d56 /tests/tcmp.c
parent36cf516e629da8c294bc7359916a7eb263e9989c (diff)
downloadmpfr-fc14d0126c36bb74758aed6e24281f13e1590407.tar.gz
Optimization: mpfr_cmp2 now accepts any combination of real arguments
and computes the sign of |b| - |c| (in addition to the number of cancelled bits); mpfr_add, mpfr_sub, mpfr_sub1, mpfr_agm and some tests updated to take this change into account. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1641 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tcmp.c')
-rw-r--r--tests/tcmp.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/tests/tcmp.c b/tests/tcmp.c
index 98b7b4412..df6f23bdd 100644
--- a/tests/tcmp.c
+++ b/tests/tcmp.c
@@ -36,6 +36,7 @@ main (void)
double x, y;
mpfr_t xx, yy;
int i, c;
+ mp_prec_t p;
mpfr_init (xx);
mpfr_init (yy);
@@ -54,18 +55,30 @@ main (void)
mpfr_set_prec (yy, 65);
mpfr_set_str_raw(xx, "0.10011010101000110101010000000011001001001110001011101011111011101E623");
mpfr_set_str_raw(yy, "0.10011010101000110101010000000011001001001110001011101011111011100E623");
- if (mpfr_cmp2(xx,yy)!=64) { printf("Error (1) in mpfr_cmp\n"); exit(1); }
+ p = 0;
+ if (mpfr_cmp2(xx, yy, &p) <= 0 || p != 64)
+ {
+ printf("Error (1) in mpfr_cmp2\n");
+ exit(1);
+ }
mpfr_set_str_raw(xx, "0.10100010001110110111000010001000010011111101000100011101000011100");
mpfr_set_str_raw(yy, "0.10100010001110110111000010001000010011111101000100011101000011011");
- if (mpfr_cmp2(xx,yy)!=64) { printf("Error (2) in mpfr_cmp\n"); exit(1); }
+ p = 0;
+ if (mpfr_cmp2(xx, yy, &p) <= 0 || p != 64)
+ {
+ printf("Error (2) in mpfr_cmp2\n");
+ exit(1);
+ }
mpfr_set_prec (xx, 160); mpfr_set_prec (yy, 160);
mpfr_set_str_raw (xx, "0.1E1");
mpfr_set_str_raw (yy, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100");
- if (mpfr_cmp2 (xx, yy) != 144) {
- printf("Error (3) in mpfr_cmp\n");
- exit(1);
- }
+ p = 0;
+ if (mpfr_cmp2 (xx, yy, &p) <= 0 || p != 144)
+ {
+ printf("Error (3) in mpfr_cmp2\n");
+ exit(1);
+ }
mpfr_set_prec(xx, 53); mpfr_set_prec(yy, 200);
mpfr_set_d(xx, 1.0, 0);