# use iterative taylor approximation to get three correct decimals of ln(2)

goal = floor(log(2)*1000)

n = 0;
taylorexp = log(1);
x=2;
do
	n++;
	taylorexp += ((-1)^(n-1)) * (1/n)*(x-1)^n;
	printf("%d	%d	%d\n", n, floor(taylorexp*1000), floor(taylorexp*1000) - goal);
until (floor(real(taylorexp) * 1000) == goal)

printf ("used %d taylor expressions\n", n);

