aboutsummaryrefslogtreecommitdiff
path: root/ic-reals-6.3/tests/sqrt_QZ.c
diff options
context:
space:
mode:
Diffstat (limited to 'ic-reals-6.3/tests/sqrt_QZ.c')
-rw-r--r--ic-reals-6.3/tests/sqrt_QZ.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/ic-reals-6.3/tests/sqrt_QZ.c b/ic-reals-6.3/tests/sqrt_QZ.c
new file mode 100644
index 0000000..610d580
--- /dev/null
+++ b/ic-reals-6.3/tests/sqrt_QZ.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+#include "real.h"
+#include <math.h>
+
+/*
+ * Tests the sqrt_QZ when applied to a rational.
+ */
+main(int argc, char *argv[])
+{
+ Real x, y;
+ Real sqrt_QZ(mpz_t, mpz_t);
+ double f;
+ mpz_t a, b;
+
+ MyName = argv[0];
+
+ if (argc != 4) {
+ fprintf(stderr, "%s <a> <b> <ndigits>\n", MyName);
+ exit(1);
+ }
+
+ initReals();
+
+ mpz_init_set_str(a, argv[1], 10);
+ mpz_init_set_str(b, argv[2], 10);
+
+ x = sqrt_QZ(a, b);
+
+ print_R_Dec(x, atoi(argv[3]));
+ printf("\n");
+}