aboutsummaryrefslogtreecommitdiff
path: root/ic-reals-6.3/tests/log_R.c
blob: 5db96d96b28c9a875263432f8d783aaf3ea70997 (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
32
33
34
35
36
37
38
39
#include <stdio.h>
#include "real.h"
#include <math.h>

/*
 * Tests the log_R when applied to a real expressed
 * by a sign, a characteristic pair and a vector.
 */
main(int argc, char *argv[])
{
	Real x, y;
	double f;
	Real makeRealSignCNQInt(Sign, char *, int, int, int);

	MyName = argv[0];

	if (argc != 7) {
		fprintf(stderr, "%s <sign> <c> <n> <a> <b> <ndigits>\n", MyName);
		exit(1);
	}

	initReals();

	y = makeRealSignCNQInt(
				atoi(argv[1]),	/* sign */
				argv[2],		/* c */
				atoi(argv[3]), 	/* n */
				atoi(argv[4]),	/* a */
				atoi(argv[5]));	/* b */

	print_R_Dec(y, atoi(argv[6]));
	f = realToDouble(y);
	printf("\nx=%f\n",f);

	x = log_R(y);

	print_R_Dec(x, atoi(argv[6]));
	printf("\nlog(x)=%f\n", log(f));
}