g0tp0t
2010-09-29 08:42:55
program new;
var x,sqr:double; n,i,iterations:integer;
function calc:double;
begin
x:= 0.5*((n-1)*x+sqr/(pow(x,n-1)))
result := x;
end;
begin
n := 2
sqr := 145
x := 99
iterations:= 10
for i := 1 to iterations do writeln(calc);
end.The output was:864
62208
4478976
322486272
23219011584
1671768834048
120367356051456
8.66644963570483E15
6.23984373770748E17
4.49268749114938E19
Successfully executed. it should have had numbers approaching the square root of 145
EDIT: i added n := 2, that changed the output and it is accurate, to the acuracy of double var type. how would i get it to be even more accurate than just those decimal places.