Off[General::spell1];
Clear[Secant,f0,x0,x1,delta,epsilon,max,x];
Secant[f0_,x0_,x1_,delta_,epsilon_,max_,d_] :=
Module[{f,k,small,cond},
  Set@@{f[x_],f0};
  p0 = x0;
  Y0 = N[f[p0],d];
  p1 = x1;
  Y1 = N[f[p1],d];
  k = 0;
  cond = 0;
  Print["p = ",N[p0,d],"\t   f[p] = ",
    N[Y0,d]];
  Print["p = ",N[p1,d],"\t   f[p] = ",
    N[Y1,d]];
  While[cond==0 && k < max,
    Df = (Y1-Y0)/(p1-p0);
    If[Df==0, cond=1;Dp=p1-p0;p2=p1,
              Dp=Y1/Df;p2=p1-Dp];
    Y2 = N[f[p2],d];
    Print["p = ",N[p2,d ],"\t   
      f[p] = ",N[Y2,d ],
            "\t  |dp| <= ",N[Dp,d ]];
             
    If[N[Abs[Dp],d] < delta,  cond=1];
    If[Abs[Y2]<epsilon, cond=1];
    p0 = p1;
    Y0 = Y1;
    p1 = p2;
    Y1 = Y2;
    k  = k+1;  ];  ]; 
On[General::spell1];

Clear[f,x];  
f[x_] = x Sin[x] - 1  ;  
Print["The function is f[x] = ",f[x]];  
Plot[f[x],{x,0,2},
PlotLabel->"The curve y = f(x)."];

Secant[f[x],0,0.5,10^-10,10^-10,10,8 ]

Clear[f,x]; 
f[x_] = 15(1 - Exp[-x/10]) - x;
Print["The function is f[x] = ",f[x]]; 
Plot[f[x],{x,0,9},
PlotLabel->"The curve y = f(x)."];

Secant[f[x],7.0,8.0,10^-10,10^-10,100,8]