Computation of natural logarithms by AG means
function ln ( x : number ) : number; var a, b, temp : number; shift, logbase : integer; begin logbase := crude_estimate_of_ln(x)/ln(BASE); if 2*logbase
sqrteps do begin temp := a; a := (a+b) / 2; b := sqrt( temp*b ) end; ln := Pi / (a+b) end end;
Pascal
source (623.ln.p)
©
Addison-Wesley
Publishing Co. Inc.