summaryrefslogtreecommitdiff
path: root/mini-gmp/tests
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2018-04-30 01:47:28 +0200
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2018-04-30 01:47:28 +0200
commit6ec06d811edc61e952268fa051f438577772f27b (patch)
tree9f0290762d913561df7064b7e75e8271ea26bb38 /mini-gmp/tests
parent311980b1baba94bf7f23e5da2fd8c720d4fbcb49 (diff)
downloadgmp-6ec06d811edc61e952268fa051f438577772f27b.tar.gz
mini-gmp/tests/t-mpq_muldiv.c: test mpq_mul (r,a,a)
Diffstat (limited to 'mini-gmp/tests')
-rw-r--r--mini-gmp/tests/t-mpq_muldiv.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/mini-gmp/tests/t-mpq_muldiv.c b/mini-gmp/tests/t-mpq_muldiv.c
index 03282da62..4d880d80c 100644
--- a/mini-gmp/tests/t-mpq_muldiv.c
+++ b/mini-gmp/tests/t-mpq_muldiv.c
@@ -52,7 +52,6 @@ testmain (int argc, char **argv)
unsigned i;
mpz_t an, bn, rn, ad, bd, rd;
mpq_t aq, bq, refq, resq;
- int tst;
mpz_init (an);
mpz_init (bn);
@@ -145,6 +144,23 @@ testmain (int argc, char **argv)
dump ("resd", mpq_denref (resq));
abort ();
}
+
+ mpq_mul (resq, aq, aq);
+ mpq_mul (refq, aq, bq); /* now bq = - aq */
+ mpq_neg (refq, refq);
+ if (!mpq_equal (resq, refq))
+ {
+ fprintf (stderr, "mpq_mul(sqr) failed [%i]:\n", i);
+ dump ("an", an);
+ dump ("ad", ad);
+ dump ("bn", bn);
+ dump ("bd", bd);
+ dump ("refn", rn);
+ dump ("refd", rd);
+ dump ("resn", mpq_numref (resq));
+ dump ("resd", mpq_denref (resq));
+ abort ();
+ }
}
mpz_clear (an);