aboutsummaryrefslogtreecommitdiff
path: root/ic-reals-6.3/tests/sqrt_QZ.c
blob: 610d580c7728ad8fe967b98a59511a8c86f8b723 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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");
}