
CLOUT("Taylor series iteration ... ").

dig:=50.

Eps:=RNRED(1,IEXP(10,dig)).

PROCEDURE Exp(x,eps);
(*Exponential function. eps is the desired precision. *)
VAR   es, s, xp, i, y: ANY;
BEGIN
(*1*) y:=RNINT(1); s:=RNINT(1); i:=0;
      es:=RNPROD(eps,RNRED(1,2));
(*2*) REPEAT i:=i+1; xp:=RNRED(1,i);
             y:=RNPROD(y,x); y:=RNPROD(y,xp);
             s:=RNSUM(s,y)
             UNTIL RNCOMP(RNABS(y),es) <= 0;
      RETURN(s)
(*9*) END Exp.

one:=RNINT(1).

e:=Exp(one,Eps).

BEGIN CLOUT("AbsErr = "); RNDWR(Eps,dig); BLINES(0) END.
BEGIN CLOUT("Result = "); RNDWR(e,dig); BLINES(0) END.
BEGIN CLOUT("Result = "); RNWRIT(e); BLINES(0) END.

CLOUT(" ... finished.").
